Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
asp123 vbnet via .NET 247 #1
How to bind checkbox to one of the values of a datagrid
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.
--------------------------------
From: asp123 vbnet
-----------------------
Posted by a user from .NET 247 ([url]http://www.dotnet247.com/[/url])
<Id>nkxP70tEuE6LR8JJtGaotg==</Id>
asp123 vbnet via .NET 247 Guest
-
bind to a checkbox
I have a tabbed flash form. the final tab is a summary page of the previous two tabbed pages. The second page lists 10 check boxes. If the... -
Bind a textfield with a checkbox
Hi all, is it possible to bind a textfield with a checkbox. What I am trying to do is, if the checkbox is selected todays date will display in the... -
Howto bind CheckBox to the datagrid/ Then update the database field when the checkbox is clicked.
I am trying to update the database field when the checkbox is clicked. I am trying to modified the following solution but.. got stuck on the... -
Null values in a datagrid checkbox column
I have a checkbox column in a bound datagrid that returns an error when it hits a null value: I can't modify the sql query to anticipate a null... -
how to bind data to checkbox in datagrid
hi i have a datagrid and one colume is a bool if i use a normal asp:BoundColumn is shows as true or false and i want it to show as a checkbox but...



Reply With Quote

