Pass Dynamic Selection for DropDownList ASP and C#

ZEUZWAP

New Member
I have a Repeater that will post a User Name, their permission levels, and a remove button.The permission level is suppose to sit in a drop down list. The default value is suppose to be what ever the user currently has. IE USER A, GuestUSER B, Group MemberUSER C, Group AdminChanging these will eventually fire a sql command to change them in the Database. But that isn't a problem, I know how to do that.The values are coming from the repeater source.ASP CODE:\[code\]<asp:SqlDataSource ID="User_Repeater_Source" runat="server" ConnectionString="<%$ ConnectionStrings:app_migrationConnectionString %>" SelectCommand="SELECT Membership.*, Users.Email, Users.Last_Name + ', ' + Users.First_Name + ' (' + Membership.User_ID + ')' as User_String FROM Membership INNER JOIN Users ON Users.User_ID = Membership.User_ID INNER JOIN Permission_Levels ON Permission_Levels.PID = Membership.PID WHERE GID = @GID"> <SelectParameters> <asp:ControlParameter ControlID="Group" DefaultValue="http://stackoverflow.com/questions/14483384/-1" Name="GID" PropertyName="SelectedValue" Type="String" /> </SelectParameters></asp:SqlDataSource><asp:SqlDataSource ID="User_PL_Source" runat="server" ConnectionString="<%$ ConnectionStrings:app_migrationConnectionString %>" SelectCommand="SELECT * FROM Permission_Levels"></asp:SqlDataSource> <td> <div class="e_Title">Edit Group Permission:</div><br /> <asp:Repeater ID="User_Repeater" runat="server" DataSourceID="User_Repeater_Source"> <HeaderTemplate> <table class="e_Repeater"> <tr> <th> User: </th> <th> Permission Level: </th> <th> Remove User: </th> </tr> </HeaderTemplate> <ItemTemplate> <tr> <td> <a href='http://stackoverflow.com/questions/14483384/<%#"mailto:" + DataBinder.Eval(Container.DataItem, "Email") %>'><%#DataBinder.Eval(Container.DataItem, "User_String" %></a> </td> <td> <asp:DropDownList ID="User_PL" runat="server" DataSourceID="User_PL_Source" DataTextField="Name" DataValueField="PID" AutoPostBack="true"></asp:DropDownList> </td> <td> <asp:Button ID="Submit_User_Remove" runat="server" Text="Remove Permission" OnCommand="Remove_User_Permission" CommandArgument='<%# Eval("AID")%>' /> </td> </tr> </ItemTemplate> <FooterTemplate> </table> </FooterTemplate> </asp:Repeater> </td>\[/code\]I am looking to pass the PID into the Dropdownlist and make that the selected choice
 
Back
Top