|
Your code worked for me. Here is my the one which worked,
protected void Page_Load(object sender, EventArgs e)
{
LoadButton();
}
private void LoadButton()
{
Button BtnSave = new Button();
BtnSave.ID = "ControlID_";
BtnSave.Text = "Update";
BtnSave.CausesValidation = true;
BtnSave.Click += new EventHandler(BtnSave_Click);
PH.Controls.Add(BtnSave);
} If ASP.NET need to maintain viewstate for your control, you may consider using OnInit event for adding dynamic controls.
|
|
|
|
|
Navneeth
Still its not working. I don't know how to put the code within the OnInit event. Please give me some example for maintaining the viewstate or some other programs which u have already implemented for generating dynamic controls...
Help me soon...
Gopinath.R
|
|
|
|
|
You can override the code like
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
LoadButton();
}
|
|
|
|
|
Hi Navaneeth
I can't put the code into the oninit because Initially i ve to give the input in the form of two dropdownlist values like check in and check out dates and then it ll dynamically creates a table consists of values with a button in a row. If i put the code into oninit method it cause some error as "null value is given to the value of dropdownlists" give me some example generation of dynamic creation of controls based on the inputs.
Thanks for ur help
Gopinath.R
|
|
|
|
|
Hi,
I'm having a problem to show a confirmation messageBox when i press my LinkButton inside my gridview..Currently i'm using gridview_RowDataBound Event :
protected void gvAllProjects_RowDataBound(object sender, GridViewRowEventArgs e)<br />
{<br />
if (e.Row.RowType == DataControlRowType.DataRow)<br />
{<br />
LinkButton lbDelete = (LinkButton)e.Row.FindControl("lnkDelBtn");<br />
<br />
lbDelete.Attributes.Add("onclick", "javascript:return " +<br />
"confirm('Are you sure you want to delete Customer : " +<br />
DataBinder.Eval(e.Row.DataItem, "mainproject_cust") + " ?')");<br />
}<br />
}
it show me the confirmation messagebox, when i press the "Ok" button the data is succesfully deleted but when i press "cancel" it delete my data too ..pls anyone give me a solution how to detect when user press "Ok" or "Cancel" button.
Thank u for the help
Regards,
Tomi
|
|
|
|
|
T.EDY wrote: lbDelete.Attributes.Add("onclick", "javascript:return " +
"confirm('Are you sure you want to delete Customer : " +
DataBinder.Eval(e.Row.DataItem, "mainproject_cust") + " ?')");
Hi,
change yr code as per below.
lbDelete.Attributes.Add("onclick", "javascript:return " +<br />
"confirm('Are you sure you want to delete Customer : " +<br />
DataBinder.Eval(e.Row.DataItem, "mainproject_cust") + " ?'); return false;");<br />
Thanks,
Sun Rays
To get something you must have to try once.
My Articles
|
|
|
|
|
|
can anyone help me to give me the add to cart fuctionality
it is really urgent
thanks in advance
|
|
|
|
|
|
If you let your client know that you're passing the work on to me, so I can invoice for it, I'd be glad to do it. Or, you could buy a component that does the work you're incapable or. Or buy a book and read it.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
How to pass the parameters of @dbName, @LogicalName, @ToServer
to job dynamically using stored procedure?
|
|
|
|
|
This belongs in the SQL forum, where I'd advise you to look into how google works. Parameters are specified by adding them to the parameters collection, heaps of info on the web, or in your books.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hello Christian Graus
i cant find reply of this question in sql forum,
that's why for fast reply i put it here.
|
|
|
|
|
And what did you find with google ? What code are you using to call your proc ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
nothing find from google.
that's why i put my question here.
i have more expectations from codeproject than google.
This is my sql job:
USE [master]
GO
declare @file as varchar(500)
declare @dbName as varchar(50)
declare @LogicalName as varchar(50)
declare @ToServer as varchar(50)
exec('ALTER DATABASE ['+@dbName+'] SET SINGLE_USER WITH ROLLBACK IMMEDIATE')
exec('RESTORE DATABASE ['+@dbName+'] FROM DISK = N''F:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\Backup\'+@file+''' WITH FILE = 1, MOVE N'''+@LogicalName+''' TO N''F:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\Data\'+@dbName+'.mdf'', MOVE N'''+@LogicalName+'_log'' TO N''F:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\Data\'+@dbName+'_log.ldf'', NOUNLOAD, REPLACE, STATS = 10')
GO
I want to pass above four parameters like @file,@dbName,@LogicalName,@ToServer from my stored procedure to above job.
so, what i have to do for this?
this is my stored procedure:
ALTER PROCEDURE runjob
AS
Declare @backupfile varchar(500),@databasename varchar(50),
@logicaldatabasename varchar(50), @toservername varchar(50)
set @backupfile = 'test1.bak';
set @databasename = 'test1';
set @logicaldatabasename = 'test1';
set @toservername = 'Live';
BEGIN
--exec sp_who2
EXEC msdb.dbo.sp_add_job
@job_name = 'k',
@file = @backupfile,
@dbName = @databasename,
@LogicalName = @logicaldatabasename,
@ToServer = @toservername
EXEC msdb.dbo.sp_start_job k
END
so, what i have to do for this? and i m receiving an error
@file is not a parameter for procedure sp_add_job.
|
|
|
|
|
Specify all parameters like this...
ALTER PROCEDURE runjob
@file1 varchar(50). @directoryName varchar(50)
AS
<procedure body="">
“The woods are lovely, dark and deep. But I have promises to keep, and miles to go before I sleep.”
|
|
|
|
|
Oh.... see, not only was this entirely a SQL question ( did you post it there ? ), but you were not asking what I thought you were asking. I kept asking you how you called the proc, b/c I thought you wanted to know how to pass the parameter into the proc. Really, you wanted to know how to write a stored proc in the first place. This is where posting code really helps, if you'd done that in the first place, I'd have made sense of your question and answered it ( the way you pass params into a proc depends on how you're calling it in .NET code, that's why I kept asking that and not giving a full answer ).
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
i am manually creating the record no in the table , database - sql-server
when i see those records in the crystal reports , it is comming in arbitrary order.
Is there any way to arrange the records in an order.All i want is that , can i use the order by clause in crystal reports.
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
Thank You to all of u...
Problem is solved.
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
I want to avoid to page to get refreshed on click of F5,Is it possible and how?
Thanks..
|
|
|
|
|
Not possible. You are programming an engine to provide HTML to IE, you cannot stop IE from working.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I've downloaded some sample project and I found that contains code of how to implement adding items from design mode (CollectionBase).
I've started to implement that into my test project I was working on and created a property like.
public MenuItemCollection MenuItems
{
get { return items; }
}
When I go to design mode and add user control, in property grid, of that user control, I have MenuItems, but it doesn't open a dialog letting me to add the items. It acts like a string .
To check whether I am crazy or not, I've added bool property to see will this work fine and display as a dropdown with true and false.
That did worked, so now I am puzzled. I've searched on the net with no luck.
I don't see any differences between that sample project and mine except that I use UserControl (partial class), but then again, why shouldn't properties work with partial classes as well (they worked with bool property) so now I am asking you for help.
Thanks.
|
|
|
|
|
Kasic Slobodan wrote: public MenuItemCollection MenuItems
{
get { return items; }
}
Looks like you are missing some attributes that has to be specified to add collection properties through property grid. I have an article which explains this. Have a look at here[^]
|
|
|
|
|
Your article helped.
Thank you.
|
|
|
|
|
Hi,
I am trying to save non-english text in my database, I tried using the ntext and nchar but none of them seems to be working..
Any ideas on how to do this
Thaaaaaaaanx
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|