How to bind checkbox to one of the values of a datagrid

  • Thread starter asp123 vbnet via .NET 247
  • Start date
A

asp123 vbnet via .NET 247

Hello All,

I hope someone can enlighten me, all of the examples and posts Ihave read and sifted through doesn't pertain to what i wouldlike to do (although i admit i haven't gone through everysingle thread there is to go to), but I am hoping to bound acheckbox to my data grid, and have the checkbox value take onthe value of one of the datagrid columns' value.

This is what i currently have:
<asp:datagrid id="dgZipCode" runat="server"BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px"BackColor="White" CellPadding="4" AutoGenerateColumns="False"Width="300" ItemStyle-Wrap="false" >
<Columns>
<asp:templatecolumn>
<itemtemplate>
<asp:checkbox runat="server" Enabled="true" id="chk1" />
</itemtemplate>
</asp:templatecolumn>
<asp:BoundColumn DataField="ZipCode" />
<asp:BoundColumn DataField="City" />
<asp:BoundColumn DataField="State" />
</Columns>
<PagerStyle HorizontalAlign="Center" ForeColor="#330099"BackColor="#FFFFCC"></PagerStyle>
</asp:datagrid>

I would like for my checkbox to take on or be associated with thezipcode value. All the examples i have seen uses either uses thecheckbox as a boolean, or retrieves the position of the checkboxin the table.

My intention is to allow the user to select the zipcode values,and then getting those zip code values that's been selected, andadd them to the database. Ideally, i would like to be able toget selected zip values, not selected checkboxes position, andthen translate these corresponding positions through thearraylist again o get the zip code.

Can anyone show me how to have the checkbox return the zipcodevalue, and also retrieve these values ?

Thank you so much for anyone who can help and replies.
 

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

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top