473,320 Members | 1,744 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Adding a hidden field to a DataGrid

Hi everyone,

I have the following code and I like to add a hidden field in each row

<asp:datagrid id="DataGrid1" style="Z-INDEX: 102; LEFT: 48px; POSITION:
absolute; TOP: 40px" runat="server"
AutoGenerateColumns="False" >
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:Checkbox ID="chkSelection" Runat="server"></asp:Checkbox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="FirstName"
HeaderText="FirstName"></asp:BoundColumn>
<asp:BoundColumn DataField="LastName"
HeaderText="LastName"></asp:BoundColumn>
</Columns>
</asp:datagrid>

Ex. something like
<asp:BoundColumn DataField="FirstName"
HeaderText="FirstName"></asp:BoundColumn>
<asp:BoundColumn DataField="LastName"
HeaderText="LastName"></asp:BoundColumn>
<input type="hidden" name="myhidden" value="<%#
DataBinder.Eval(Container.DataItem, "RowID") %>" runat=server"> which
doesn't work

Any idea?

Thank you
Maz.


Nov 16 '05 #1
1 5401
Hello

<input type="hidden" name="myhidden" value='<%#
DataBinder.Eval(Container.DataItem, "RowID") %>' runat=server">

Use single quotes in value instead of double quotes.

Best regards,
Sherif

"Maziar Aflatoun" <ma***@rogers.com> wrote in message
news:qe**********************@twister01.bloor.is.n et.cable.rogers.com...
Hi everyone,

I have the following code and I like to add a hidden field in each row

<asp:datagrid id="DataGrid1" style="Z-INDEX: 102; LEFT: 48px; POSITION:
absolute; TOP: 40px" runat="server"
AutoGenerateColumns="False" >
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:Checkbox ID="chkSelection" Runat="server"></asp:Checkbox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="FirstName"
HeaderText="FirstName"></asp:BoundColumn>
<asp:BoundColumn DataField="LastName"
HeaderText="LastName"></asp:BoundColumn>
</Columns>
</asp:datagrid>

Ex. something like
<asp:BoundColumn DataField="FirstName"
HeaderText="FirstName"></asp:BoundColumn>
<asp:BoundColumn DataField="LastName"
HeaderText="LastName"></asp:BoundColumn>
<input type="hidden" name="myhidden" value="<%#
DataBinder.Eval(Container.DataItem, "RowID") %>" runat=server"> which
doesn't work

Any idea?

Thank you
Maz.

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Rick | last post by:
I want to add items to a list and then submit these items via POST in a form. Below is my code and it adds the items fine but they are not selected when I submit the form how can I have them all...
2
by: Clayton Hamilton | last post by:
I have a DataGrid on a webform bound to a Datasource and can successfully use <ItemTemplate> to create edit/update/cancel functionality for user maintenance of data. I use separate logic to delete...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
2
by: Jiho Han | last post by:
In CreateChildControls method of my Page, I am trying to see if a hidden input field is present (by id) and if not, add it to a predefined form (by id). protected override void...
4
by: Maziar Aflatoun | last post by:
Hi everyone, I have the following code and I like to add a hidden field in each row <asp:datagrid id="DataGrid1" style="Z-INDEX: 102; LEFT: 48px; POSITION: absolute; TOP: 40px" runat="server"...
3
by: Craig G | last post by:
what way do you code it? i tried the following but it wouldnt display it lblAdd_info is a hidden field in the cell itself that contains the data i want to display in the tooltip text. i added the...
2
by: Not Me | last post by:
Hi, In a datagrid's itemcommand method, I can use DataGridCommandEventArgs/item/cells/text to bring up a specific field from a row that was accessed. However, I wish to lookup data from that...
2
by: Rodusa | last post by:
I have a hidden field inside one datagrid which I can't get to make it keep its state after a postback event. Look field: <input type="hidden" id="TxtHiddenItem_id" name="TxtHiddenItem_id"...
8
by: shumaker | last post by:
I'm wondering if adding an autonumber primary key will improve the performance of a multiuser access database on a network share. I have a website that lists many tips for improving performance of...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.