Getting the Checked items of a datagrid in an Array.
-
Hi there, I have a doubt reg the Datagrid which uses a CheckBox Column. I have a Webform.In that I have 2 option buttons,1 Datagrid,1 Button. The 2 option buttons are : 1)Employee_btn(When i select this,Datagrid will be filled with the Employee ID,Employee name along with the CheckBox Column). 2)Department_btn(When i select this,Datagrid will be filled with the Department_name) 1 Button is Submit_Btn Now my requirement is I need to take the checked Items from the datagrid and store it in a char Array(For example,when I select 2 out of 3 department names I need to store the two department names in a string array. How to do that?? Kindly help me as soon as possible.I need to finish this with in 3 days. Thanks in advance.
Happy Programming!!!
-
Hi there, I have a doubt reg the Datagrid which uses a CheckBox Column. I have a Webform.In that I have 2 option buttons,1 Datagrid,1 Button. The 2 option buttons are : 1)Employee_btn(When i select this,Datagrid will be filled with the Employee ID,Employee name along with the CheckBox Column). 2)Department_btn(When i select this,Datagrid will be filled with the Department_name) 1 Button is Submit_Btn Now my requirement is I need to take the checked Items from the datagrid and store it in a char Array(For example,when I select 2 out of 3 department names I need to store the two department names in a string array. How to do that?? Kindly help me as soon as possible.I need to finish this with in 3 days. Thanks in advance.
Happy Programming!!!
Means selected departments want to be store in table fields?,
Regards, Magi
-
Means selected departments want to be store in table fields?,
Regards, Magi
Table field is also ok.... FYI i am using asp.net with C#..
Happy Programming!!!
-
Table field is also ok.... FYI i am using asp.net with C#..
Happy Programming!!!
Hi i am given code based on vb.net..., c# and vb.net both are similar only..., I hope,my code will be use full for u..., For Each MainGRD As DataGridItem In Me.dgrdmain.Items 'dgrdmain is datagrid id name sqlconn.Open() Dim Check As CheckBox = CType(MainGRD.FindControl("ck"), CheckBox) 'ck is checkbox id name If Check.Checked = True Then Dim strInsertproc As String Dim EId As Integer = Val(MainGRD.Cells(1).Text) Dim BcCal As Decimal = Val(MainGRD.Cells(2).Text) 'like the above code u can get the values from datagrid cells..., Try strInsertproc = "spn'" & EId & "','" & BcCal & "'" 'spn is stored procedure name sqlCmd = New SqlCommand(strInsertproc, sqlconn) sqlCmd.ExecuteNonQuery() lblMessage.Text = "Record Inserted............" Catch ex As Exception If Mid(ex.Message, 1, 9) = "Violation" Then lblMessage.Text = "Already exist in the DataBase......" Else lblMessage.Text = Mid(ex.Message, 1, 75) ' Show friendly error message. End If End Try End If sqlconn.Close() Next Take care...,
Regards, Magi
-
Hi there, I have a doubt reg the Datagrid which uses a CheckBox Column. I have a Webform.In that I have 2 option buttons,1 Datagrid,1 Button. The 2 option buttons are : 1)Employee_btn(When i select this,Datagrid will be filled with the Employee ID,Employee name along with the CheckBox Column). 2)Department_btn(When i select this,Datagrid will be filled with the Department_name) 1 Button is Submit_Btn Now my requirement is I need to take the checked Items from the datagrid and store it in a char Array(For example,when I select 2 out of 3 department names I need to store the two department names in a string array. How to do that?? Kindly help me as soon as possible.I need to finish this with in 3 days. Thanks in advance.
Happy Programming!!!