A.aspx页面 ASPxGridView中,实现单选显示方法:gridviewdatatextcolumn下dataitemtemplate中放入RadioButtonList控件,SelectedValue绑定value值ASPxGridView中
A.aspx页面
<dxwgv:ASPxGridView ID="gvModuleForm" ClientInstanceName="gvModuleForm"
runat="server" Width="544px"
AutoGenerateColumns="False" KeyFieldName="FormElementID"
CssFilePath="~/App_Themes/Office2003 Blue/{0}/styles.css"
CssPostfix="Office2003_Blue">
<SettingsBehavior AllowFocusedRow="True" />
<ClientSideEvents SelectionChanged="function(s, e) {
alert('test');
}" />
<Styles CssFilePath="~/App_Themes/Office2003 Blue/{0}/styles.css"
CssPostfix="Office2003_Blue">
<Header ImageSpacing="5px" SortingImageSpacing="5px">
</Header>
<LoadingPanel ImageSpacing="10px">
</LoadingPanel>
</Styles>
<Columns>
<dxwgv:GridViewDataTextColumn Caption="表单元素名称" FieldName="FormName"
VisibleIndex="0">
</dxwgv:GridViewDataTextColumn>
<dxwgv:gridviewdatatextcolumn FieldName="FormType" Caption="权限" VisibleIndex="1">
<dataitemtemplate>
<asp:RadioButtonList ID="rdobtnFormType" runat="server"
RepeatDirection="Horizontal" Width="245px" SelectedValue='<%# Eval("FormType") %>' >
<asp:ListItem Value="0" >可见</asp:ListItem>
<asp:ListItem Value="1" >不可见</asp:ListItem>
<asp:ListItem Value="2">可见不可编辑</asp:ListItem>
</asp:RadioButtonList>
</dataitemtemplate>
</dxwgv:gridviewdatatextcolumn>
<dxwgv:GridViewDataTextColumn Caption="元素ID" FieldName="FormElementID"
VisibleIndex="2">
</dxwgv:GridViewDataTextColumn>
</Columns>
<Images ImageFolder="~/App_Themes/Office2003 Blue/{0}/">
<CollapsedButton Height="12px"
Url="~/App_Themes/Office2003 Blue/GridView/gvCollapsedButton.png"
Width="11px" />
<ExpandedButton Height="12px"
Url="~/App_Themes/Office2003 Blue/GridView/gvExpandedButton.png" Width="11px" />
<DetailCollapsedButton Height="12px"
Url="~/App_Themes/Office2003 Blue/GridView/gvCollapsedButton.png"
Width="11px" />
<DetailExpandedButton Height="12px"
Url="~/App_Themes/Office2003 Blue/GridView/gvExpandedButton.png" Width="11px" />
<FilterRowButton Height="13px" Width="13px" />
</Images>
</dxwgv:ASPxGridView>
A.aspx.cs 后台代码,直接绑定字段:
var ModuleFormList = from M1 in eDataContext.FormElement
join M2 in eDataContext.DataShowAuthorization
on M1.FormElementID equals M2.FormElementID
where M1.ModuleFormID == intModuleFormID && M2.RoleID == intRoleID
select new { FormElementID = M1.FormElementID, FormName = M1.FormElementName, FormType = M2.AuthorizationType };
this.gvModuleForm.DataSource = ModuleFormList;
本文作者:网友 来源:网络
CIO之家 www.ciozj.com 微信公众号:imciow