Last post Dec 21, 2017 01:20 PM by anas
Dec 21, 2017 12:34 PM|cfcorp|LINK
Ive got a listivew that has autogenerated CRUD operations that relate to a user table containing user id, password and access level.
The access level determines if the user is an Admin or regular user and is just an int value at the moment.
In my list view when someone clicks the Edit button the dropdown box appears with two selectable values, Admin or User.
in the source of the page I configured the Admin selection to have a value of 1
and the user selection to have a value of 2.
My question is how do I define it so that the dropdown updates in the autogenerated edit query, the default textbox that was there has the @accesslevel.
I am just unsure as to how the value is binded from the drop down goes to in place of the textbox value?
Here is my listbox code, the default textbox worked fine so the original autogenerated INSERT comand was working.
<asp:DropDownList ID="AccessLevelTextBox" runat="server" >
<asp:ListItem Text="Admin" Value="1" />
<asp:ListItem Text="User" Value="2" />
<%--<asp:TextBox ID="AccessLevelTextBox" runat="server" Text='<%# Bind("AccessLevel") %>' />--%>
Dec 21, 2017 01:20 PM|anas|LINK
I assume that in the database , you will store 1 or 2 for the access level and not the string value.
You can try this:
<asp:DropDownList ID="AccessLevelTextBox" runat="server" SelectedValue='<%# Bind("AccessLevel") %>'>