Keeping track of controls in a DataGrid

M

Manuel

I have the following DataGrid:

<asp:datagrid id="grdPackages" runat="server" AutoGenerateColumns="False"
AllowSorting="True">
<Columns>
<asp:BoundColumn DataField="ShipDate" SortExpression="ShipDate"
HeaderText="Ship Date"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="Confirm">
<ItemTemplate>
<asp:Button id="btnConfirm" runat="server" Text="Confirm"></asp:Button>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>


How do I add functionality to the btnConfirm? I want to calculate another
value based on the ShipDate [and store it in a database], how do I get the
date of the row?
 
J

John Saunders

Manuel said:
I have the following DataGrid:

<asp:datagrid id="grdPackages" runat="server" AutoGenerateColumns="False"
AllowSorting="True">
<Columns>
<asp:BoundColumn DataField="ShipDate" SortExpression="ShipDate"
HeaderText="Ship Date"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="Confirm">
<ItemTemplate>
<asp:Button id="btnConfirm" runat="server"
Text="Confirm"></asp:Button>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>


How do I add functionality to the btnConfirm? I want to calculate another
value based on the ShipDate [and store it in a database], how do I get the
date of the row?

Use the ItemDataBound event of the DataGrid.

John Saunders
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top