a listview control with checkboxes
how to pass the checked checkbox values in sql query for updation
please help me
a listview control with checkboxes
how to pass the checked checkbox values in sql query for updation
please help me
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Niradhip ChakrabortyPosted May 15, 2008, 1:39 PM
U can do one thing. You can use a datagrid and Inside datagrid add your checkbox. So it is work
same as listview.Even u also can use listview.I will give you code for datagrid.
The code has two part first part is html part or .aspx part and the last part is codebehind or
.aspx.vb part.
Add datagrid and checkbox like following way in html.
I guess you are taking the checkbox name from a table. say it is employee table and you want all employee name to be displayed as
checkbox.say column name is emp_vch_Name
.aspx:
<%# DataBinder.Eval(Container.DataItem,"emp_vch_Name")%>
.aspx.vb code:
Now you want to pass the checked checkbox value to database.If it is checked it store the value as 1 if it is not checked it
store the value as 0.
Dim blnEmployee As Boolean
For Each dgrdItem In dgrdDayEnd.Items
blnEmployee = False
If CType(dgrdItem.FindControl("chkEmployee"), WebControls.CheckBox).Checked = true Then
blnEmployee = True
End If
strSQL = "Write your update query here and pass the value blnEmployee for particular column in the table where you want to store checked or unchecked checkbox value "
Next
Try it first...................
Still if u have doubt then send me your full code both .aspx code and .aspx.vb code i will try to fix it.