I have a ASP.Net DataGrid with edit columns. I bring in a list of users with info like account number, custid etc. Everything works fine.
Now I want to add an edit column that contains a multiple select listbox. When the listbox loads I want to select the appropriate items for the user. Anyone know how to do this?
So far I am able to show the listbox with all available choices. So all I need to do now is pick/select the items for the user.
This is my datagrid:
Thanks for you thoughts and help.
Now I want to add an edit column that contains a multiple select listbox. When the listbox loads I want to select the appropriate items for the user. Anyone know how to do this?
So far I am able to show the listbox with all available choices. So all I need to do now is pick/select the items for the user.
This is my datagrid:
Code:
<asp:datagrid id="dgUsers" runat="server" Width="424px" Height="96px" OnDeleteCommand="dgUsers_Delete" OnItemCommand="dgUsers_ItemCommand" OnEditCommand="dgUsers_Edit" OnCancelCommand="dgUsers_Cancel" OnUpdateCommand="dgUsers_Update"
DataKeyField="USERID" BackColor="Gray" ForeColor="Black" Font-Size="X-Small" Font-Names="Arial"
HorizontalAlign="Center" AllowPaging="True" PageSize="5" AutoGenerateColumns="False">
<HeaderStyle Font-Size="Smaller" Font-Names="Arial" Font-Bold="True" Wrap="False" HorizontalAlign="Center"
ForeColor="Black" VerticalAlign="Middle" BackColor="Red"></HeaderStyle>
<Columns>
<asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
<asp:ButtonColumn ButtonType="LinkButton" Text="Delete" CommandName="Delete"></asp:ButtonColumn>
<asp:BoundColumn DataField="USER_NAME" HeaderText="User Name"></asp:BoundColumn>
<asp:BoundColumn DataField="UPASSWORD" HeaderText="Password"></asp:BoundColumn>
<asp:BoundColumn DataField="FIRST_NAME" HeaderText="First Name"></asp:BoundColumn>
<asp:BoundColumn DataField="LAST_NAME" HeaderText="Last Name"></asp:BoundColumn>
<asp:BoundColumn DataField="USER_EMAIL" HeaderText="Email"></asp:BoundColumn>
<asp:TemplateColumn ItemStyle-VerticalAlign="Top" HeaderText="Info">
<EditItemTemplate>
[COLOR=blue]
<asp:DropDownList runat="server" id="Groups" DataSource='<%# GetGroups() %>' DataTextField="DESCRIPTION" DataValueField="GID" >
</asp:DropDownList>
[/color]
</EditItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="UPDATE_DATE" HeaderText="Last Update" ReadOnly="True"></asp:BoundColumn>
<asp:BoundColumn DataField="USERID" HeaderText="Uid" ReadOnly="True"></asp:BoundColumn>
<asp:BoundColumn DataField="CUSTID" HeaderText="Cid" ReadOnly="True"></asp:BoundColumn>
<asp:BoundColumn DataField="UPDATE_USERID" HeaderText="Update Uid" ReadOnly="True"></asp:BoundColumn>
</Columns>
</asp:datagrid>
Thanks for you thoughts and help.