2010-11-11 27 views

回答

0

使用ASP模板字段并在您的GridView中的单个项目模板

<asp:TemplateField id="test" runat="server"> 
    <ItemTemplate> 
     <ItemTemplate> 
      test 
     </ItemTemplate> 
     <EditItemTemplate> 
      <asp:TextBox Text="test" runat="server"/> 
     </EditItemTemplate> 
    </ItemTemplate> 
</asp:TemplateField> 

我从内存中完成了上述操作。下面有一个例子链接,我发现还有: http://programming.top54u.com/post/ASP-Net-GridView-Edit-ItemTemplate-Mode.aspx

+0

不,我真的想在Devexpress中看到它ASPxGridview控制 – Programmersohel 2010-11-11 04:15:09

+0

在插入模式我想显示一种模板和编辑模式我想在C#.NET中显示另一种模板在Devexpress aspxGridview控制 – Programmersohel 2010-11-11 04:16:49

+0

嗨,是我在上面的答案中使用usercontrols的方法为你工作?请尝试。如果您需要更多帮助,请联系我们的支持团队:http://www.devexpress.com/Support/Center/CreateIssue.aspx?issuetype=Question – Mehul 2010-11-29 21:57:39

3

这可以通过以下方法来实现:

应定义EditFormTemplate以便它包含一套不同的编辑器插入和编辑功能。基于ASPxGridView的IsNewRowEditing属性值处理HtmlRowCreated事件以隐藏不需要的编辑器。

查看sample project关于此issue,演示了基于用户控件和绑定表达式的解决方案。在该方案中,EditForm模板包含绑定到ASPxGridView.IsNewRowEditing属性的Visible属性两个用户控件:

[HTML]

<uc1:Edit id="Edit1" runat="server" Visible="<%# !Container.Grid.IsNewRowEditing %>"></uc1:Edit> 
<uc2:Insert id="Insert1" runat="server" Visible="<%# Container.Grid.IsNewRowEditing %>"></uc2:Insert> 

顺便说一句,这issue或许也有帮助。如果您需要更多帮助,请联系DevExpress支持团队here

相关问题