|
Hi Sagar
How much data you want to store in hidden field ?
i have given the good solution in last post i think that is better option
Thanks and Regards
Sandeep
If you want something you never had,
do something you have never done!
|
|
|
|
|
Just I need to send name of the user to next page .Here my requirement is use hiddenField.Pls tell me u r valuable solution .
Thanks.
-- modified at 7:52 Monday 23rd April, 2007
|
|
|
|
|
Hi Sagar this is your solution
Add Hidden feild control to your aspx page
set the value of it in button click event
Now you can get in any page
set the value
<br />
<asp:HiddenField ID="PeronName" runat="server" /><br />
in button click event <br />
PeronName.Value = TextBox1.Text;<br />
Now you can get this value ib your 2,3,4,5 pages just by
Request.Params["PeronName"]; returns your Paerson name
Now enjoy And please first try to search on Google if failed to get any solution then only post on forums Keep learnig my friend Google is your best friend not Forums
Thanks and Regards
Sandeep
If you want something you never had,
do something you have never done!
|
|
|
|
|
I have a form lot of server controls are there like textboxes , labels, dropdownlist etc., I want to clear all the textboxes in one javascript function,Instead of passing of all the textboxes id's.
|
|
|
|
|
Your statement makes no sence to me infact you havnt asked for anything. The only answer i can give yout is to go ahead and do what you want. Try and be clear of what exactly you need.
Mubashir
Software Architect
Storan Technologies Inc, USA
Every job is a self portrait of the person who did it.
|
|
|
|
|
What you need to do is to loop through all the controls in the form and then if it is a textbox you clear it.
you can use document.Form1.elements.length to get the complete number of controls available and here Form1 is the form name.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Hi,
I created a datagrid that is bound at runtime with a database. This datagrid also has a template column, but this template column is displayed at the beginning of the datagrid (at the far left), I want this template column to be on the far right...How can I do that? The problem is that the other columns in the datagrid are bound at runtime so at design time this template column is the first column to be displayed??..is there anyway to fix this??
thnx in advance
|
|
|
|
|
If you are creating all the columns of the datagrid at runtime then create the template column also at runtime.
Alternatively are you specifying the bound column at design time then put the template column part at the last(after the bound columns) and it will be displayed at the last only.
Best Regards,
Apurva Kaushal
|
|
|
|
|
thnx but how can I do that, I wrote something like that but I can't seem to link it with the datagrid.
TemplateColumn tc = new TemplateColumn();
tc.HeaderText = "Display on Map";
LinkButton LinkButton2 = new LinkButton();
LinkButton2.CommandName = "btnShow2";
I don't know the exact code for it, coz I've always use the wizard from the design.
|
|
|
|
|
First you need to create the template column and then in the itemdatabound event create the control which you want to be there in the template column. Also put templatecreation code after the bound column creation code.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Do u have any Link for an example that I can use as a reference??
|
|
|
|
|
I don't know about the link but you can search through google.
BTW here is the code to create bound column and template column dynamically:
BoundColumn bCol = new BoundColumn();<br />
bCol.DataField = DC.ColumnName;<br />
bCol.HeaderText = DC.ColumnName;
here DC is the datacolumn.
TemplateColumn tColStatus = new TemplateColumn();
tColStatus.HeaderText = "Status";
only thing is after creating these columns you need to add them to the datagrid and once it is done in the itemdatabound event you can place the following code to add the control to the template column.
<br />
Label lblStatus = new Label();<br />
lblStatus.EnableViewState = true;<br />
lblStatus.ID = "lblStatus";<br />
lblStatus.Text = "Pending";<br />
e.Item.Cells[index of the template column].Controls.Add(lblStatus);
Best Regards,
Apurva Kaushal
|
|
|
|
|
thnx for the code, really helpful but there's still one problem, when I insert the linkButton using this code:
e.Item.Cells[1].Controls.Add(LinkButton2);
The header of the template column becomes the control itself, I mean the header becomes a LinkButton too, so why does that happen..and how can I resolve this issue??
thnx in advance for all ur help
|
|
|
|
|
That is OK what you need to do is to put the code of itemdatabound event inside this "if" loop:
if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
Best Regards,
Apurva Kaushal
|
|
|
|
|
thnx a loooot
sorry for bothering u but the linkbutton doesn't execute the ItemCommand event. I wrote:
LinkButton2.CommandName = "lnkShow";
and then inside the DataGrid_ItemCommand event I wrote some code that executes something in the web application, but when I press the LinkButton, nothing is executed and the new column actually disappears from the datagrid..Am I missing something in the code??
sorry again and thnx in advance for all ur help
|
|
|
|
|
Nada Adel wrote: DataGrid_ItemCommand event I wrote some code that executes something in the web application
this has to get executed. Have you mention about the item command event in the datagrid.
Nada Adel wrote: new column actually disappears from the datagrid
This is happening because you are not binding the datagrid again after the itemcommand event. You need to bind the grid in the itemcommand also.
Best Regards,
Apurva Kaushal
|
|
|
|
|
thnx for the quick reply
I've mentioned the Item_Command event of the datagrid:
public void DataGrid1_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
DataGrid1.DataBind();
Response.Write("Nada"); //does not appear
if (e.CommandName == "lnkShow2")
{
//Some code
}
}
when I press the linkbutton in the template column, the item_command event. He never enters it in the first place. It is never executed.
Did I miss the definition of the Item_Command event, I mean it was working when I designed the Template Column at design time. Is there something missing. Here's my code:
TemplateColumn tColStatus = new TemplateColumn();
tColStatus.HeaderText = "Status";
DataGrid1.Columns.Add(tColStatus);
// Creating the Control
protected void DataGrid1_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
LinkButton LinkButton2 = new LinkButton();
LinkButton2.EnableViewState = true;
LinkButton2.ID = "lnkShow";
LinkButton2.Text = "Show";
LinkButton2.CommandName = "lnkShow2";
e.Item.Cells[1].Controls.Add(LinkButton2);
}
}
Please check it and let me know if I missed something. I really want it work. I appreciate all ur help
|
|
|
|
|
You need to attach the event to the datagrid. Something like this:
DataGrid1.ItemCommand +=new DataGridCommandEventHandler(this.DataGrid1_ItemCommand);
Best Regards,
Apurva Kaushal
|
|
|
|
|
still, not executed?? where exactly shall I put it??
|
|
|
|
|
Just after the datagrid binding and creating columns code.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Still not working, sorry.. I give up, the DataGrid_ItemCommand is not invoked at all?
I don't know what to do.
|
|
|
|
|
I don't find any reason for it not functioning. You debug it properly and then can see what exactly is the problem. Because I have implemented the same thing and it is working absolutely fine for me.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Thnx a loot, well I did in a different way using TemplateColumns at design time and I bound them to certain fields in the database using DataBinder.Eval.. pretty neat and the LinkButton is shown as the last column successfully.
Anyaways..thnx a lot, just bothering urselft to answer questions is a big thing for me..
|
|
|
|
|
Always welcome..
Its really nice that finally you got the things working (By whatever way )
Best Regards,
Apurva Kaushal
|
|
|
|
|
Hi all,
I want to compare my system time with the time in MS Access table. I want to display those records which are greater than the current time(even the seconds not the milli seconds).
Plz any one suggest me the query.
Thanks in advance
bye
Know is Drop, Unknown is Ocean
|
|
|
|