日期:2014-05-18 浏览次数:20793 次
private void GetUsersMSGDataGrid_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { //string tmp = e.Item.Cells[5].Text; for(int i=0;i<GetUsersMSGDataGrid.Items.Count;i++) { string tmp = GetUsersMSGDataGrid.Items[i].Cells[5].Text; if(GetUsersMSGDataGrid.Items[i].Cells[5].Text=="0") GetUsersMSGDataGrid.Items[i].Cells[5].Text = "普通用户"; else GetUsersMSGDataGrid.Items[i].Cells[5].Text = "管理员"; } }
<asp:TemplateColumn HeaderText="权限"> <ItemTemplate> <asp:Label runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.UserType")%>'> </asp:Label> </ItemTemplate> <EditItemTemplate> <asp:DropDownList runat="server" SelectedIndex='<%# GetUserTypeIndex(DataBinder.Eval(Container.DataItem, "usertype").ToString()) %>' id="edit_usertype"> <asp:ListItem Value="0">普通用户</asp:ListItem> <asp:ListItem Value="1">管理员</asp:ListItem> </asp:DropDownList> </EditItemTemplate>