How to give control to radiobuttons in asp.net using vb.net

Posted by Nagesai under VB.NET on 1/7/2016 | Points: 10 | Views : 1870 | Status : [Member] | Replies : 1
Hi I have 3 radiobuttons 1.open 2.department 3.restricted to selected users and I have a list box below the radiobuttons where I have the users list now what my aim is when I select restricted to selected users and I click user names in the list the users cannot access the data my problem is can anyone suggest how to connect this radio buttons to users list. By the way I am using vb.net Below is the code in aspx

<tr>
<td style="width:120px;text-align:top" class="blue">SecurityLevel:*</td>
<td class="auto-style9">
<asp:Label ID="lblSecurityLevel" runat="server" ></asp:Label>
<asp:radiobuttonlist id="rbSecurityLevel" runat="server">
<asp:listitem id="option1" runat="server" value="Open" />
<asp:listitem id="option2" runat="server" value="Confidential to Department" />
<asp:listitem id="option3" runat="server" value="Restricted to Selected Users" />
</asp:radiobuttonlist > </td>
</tr>
I want to get answer as soon as possible its very urgent.




Responses

Posted by: Jayakumars on: 1/8/2016 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Hi

Try this code

Protected Sub rbSecurityLevel_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
If rbSecurityLevel.SelectedValue = "1" Then
lstemployee.Items.Clear()
BindRecords()
Else If rbSecurityLevel.SelectedValue = "2" Then
lstemployee.Items.Clear()
BindRecords()
Else If rbSecurityLevel.SelectedValue = "3" Then
lstemployee.Items.Clear()
BindRecords()
End If
End Sub

Private Sub BindRecords()
Dim Dt As DataTable = New DataTable()
Dim sqlad As SqlDataAdapter = New SqlDataAdapter("Select * from EmpDetails",sqlcon)
sqlad.Fill(Dt)
lstemployee.DataSource = Dt
lstemployee.DataTextField = "EmpName"
lstemployee.DataValueField = "EmpId"
lstemployee.DataBind()
End Sub

Mark as Answer if its helpful to you

Kumaraspcode2009@gmail.com

Nagesai, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response