Click here to Skip to main content
15,888,590 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
1. 
pls i need Answer this question by vb code language pls what can i change in this code to fix my proplem

 I have 2 controls radcombobox and gridview
2.  Radcombobox databind
Private con As New SqlConnection("Data Source=bma-pc;Initial Catalog=hrdb;Integrated Security=True")


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        '   RadComboBoxEmp1_ID.AutoPostBack = True


        Dim adapter As New SqlDataAdapter("SELECT   EMPL_ID, EMPL_ID+' '+FIRST_NAME+' '+ISNULL(SECOND_NAME,' ')+' '+ ISNULL(FAMILY_NAME,' ') as EMPL_NAME FROM  HAL_HR_EMPLOYE_BSC_TAP where  END_SERVC_FLG   LIKE  '0' OR  END_SERVC_FLG  IS NULL  order by cast([EMPL_ID]as int) asc ", con)
        Dim links As New DataTable()
        adapter.Fill(links)

        RadComboBoxEmp1_ID.DataTextField = "EMPL_NAME"
        RadComboBoxEmp1_ID.DataValueField = "EMPL_ID"
        RadComboBoxEmp1_ID.DataSource = links
        RadComboBoxEmp1_ID.DataBind()

   End Sub


3.  Radcombobox I don’t have properties  EnableCheckAllItemsCheckBox="true" I create 2 checkbox control in radcombobox template

a.  <HeaderTemplate>

<asp:CheckBox ID="CheckBox2" runat="server" Text="ALL" AutoPostBack="True"
oncheckedchanged="CheckBox2_CheckedChanged" />
</HeaderTemplate>
b.  <ItemTemplate>
 <asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True"
                  AutoPostBack="True"
oncheckedchanged="CheckBox2_CheckedChanged"
Text='<%# Eval("EMPL_NAME") %>' />
</ItemTemplate>
c.  Behind code
  Protected Sub CheckBox2_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)

        Dim chk As CheckBox = TryCast(sender, CheckBox)

        If chk.ID = "CheckBox2" Then
            For Each item As RadComboBoxItem In RadComboBoxEmp1_ID.Items
                '  If item..RowType = DataControlRowType.DataRow Then

                item.Controls.OfType(Of CheckBox)().FirstOrDefault().Checked = chk.Checked

                ' row.Cells(2).Controls.OfType(Of RadComboBox)().FirstOrDefault().Visible = False
                '   End If
                TextBox1.Text += "'" & item.Value & "',"


            Next



        End If

        For Each item As RadComboBoxItem In RadComboBoxEmp1_ID.Items

            DirectCast(item.FindControl("CheckBox1"), CheckBox).Checked = chk.Checked
            If DirectCast(item.FindControl("CheckBox1"), CheckBox).ID <> "CheckBox1" Then
                chk.Checked = False
            End If
            '  chk.Checked = False
            ' Dim chk As CheckBox = TryCast(sender, CheckBox)
            ' If chk.Checked = True Then
            TextBox2.Text += DirectCast(item.FindControl("CheckBox1"), CheckBox).ID & ", "
            'End If
            If DirectCast(item.FindControl("CheckBox1"), CheckBox).Checked = True Then
                DirectCast(item.FindControl("CheckBox1"), CheckBox).Checked = True
                TextBox2.Text += DirectCast(item.FindControl("CheckBox1"), CheckBox).ID & ", "
            End If



        Next

        RadComboBoxEmp1_ID.OpenDropDownOnLoad = True

    End Sub




When I dropdownopen radcombobox show select check  all object with checkbox CheckBox2 name  and when I change the checkbox all it select check  all object  and remove all select check  when I remove
In ItemTemplate but my problem start when I change  checkbox in <ItemTemplate>  <asp:CheckBox ID="CheckBox1" here when I select item with select check 1 by 1 or remove some select check not work I need help to change select check

4.  Gridview I need after select check  in radcombobox but the value in
Private Sub BindGrid()
Dim cmd As New SqlCommand("SELECT   EMPL_ID, EMPL_ID+' '+FIRST_NAME+' '+ISNULL(SECOND_NAME,' ')+' '+ ISNULL(FAMILY_NAME,' ') as EMPL_NAME FROM  HAL_HR_EMPLOYE_BSC_TAP where here after select check how I but the value from radcombobox  ")
GridViewEmpl.DataSource = Me.ExecuteQuery(cmd, "SELECT")
GridViewEmpl.DataBind()

to get data in the gridview filtering or find item by radcombobox or create parameter to get select check pls help me what to do
Posted
Updated 27-Oct-14 21:05pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900