Gridview模板字段 [英] Gridview template field

查看:60
本文介绍了Gridview模板字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友,





我正在使用gridview和模板字段。如果我们将列表框放在edititem模板中,那么如果我们把sqldatasource然后错误来了sql server登录失败。下面是code.Plz帮帮我。



Friends,


I am using gridview with the template fields.If we put list box in the edititem template then if we put sqldatasource then the error is coming "Login failed for sql server".Below is the code.Plz help me.

<asp:TemplateField HeaderText="ImpactedEntity">
   <ItemTemplate>
   <%#Eval("ImpactedEntity")%>
   </ItemTemplate>
   <EditItemTemplate>
       <asp:ListBox ID="ListBox3" runat="server" AutoPostBack="True"
           DataSourceID="SqlDataSource1" DataTextField="ImpactedEntity"
           DataValueField="ImpactedEntity"></asp:ListBox>
       <asp:SqlDataSource ID="SqlDataSource1" runat="server"
           ConnectionString="<%$ ConnectionStrings:DashboardConnectionString %>"
           SelectCommand="SELECT [ImpactedEntity] FROM [Bug]"></asp:SqlDataSource>
   </EditItemTemplate>
    <FooterTemplate>
   <asp:TextBox ID="txtImpactedEntity" runat="server">
                   </asp:TextBox>
   </FooterTemplate>
   </asp:TemplateField>





先谢谢



Thanks in Advance

推荐答案

ConnectionStrings:DashboardConnectionString %>
SelectCommand =SELECT [ImpactedEntity] FROM [Bug]>< / asp:SqlDataSource>
< / EditItemTemplate>
< FooterTemplate>
< asp:TextBox ID =txtImpactedEntityrunat =server>
< / asp:TextBox>
< / FooterTemplate>
< / asp:TemplateField>
ConnectionStrings:DashboardConnectionString %>" SelectCommand="SELECT [ImpactedEntity] FROM [Bug]"></asp:SqlDataSource> </EditItemTemplate> <FooterTemplate> <asp:TextBox ID="txtImpactedEntity" runat="server"> </asp:TextBox> </FooterTemplate> </asp:TemplateField>





先谢谢



Thanks in Advance


这篇关于Gridview模板字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆