怎样把gridview以外的 textbox的内容添加到 gridview,等代码不要文字回答。。。测试无错误追加分。。。 10
3个回答
展开全部
用GridView的事件:前台
<asp:Label ID="Label1" class="title_l" runat="server" Text="著作人姓名"></asp:Label>
<asp:GridView ID="gvInfo" runat="server" Width="100%" AutoGenerateColumns="False"
CssClass="list" BorderWidth="0" CellSpacing="1" onrowdatabound="gvInfo_RowDataBound">
<Columns>
<asp:TemplateField HeaderText="著作人姓名">
<ItemStyle HorizontalAlign="Center" />
<ItemTemplate>
<asp:HyperLink ID="FZR" runat="server" ForeColor="Blue"></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
后台:
protected void gvInfo_RowDataBound(object sender, GridViewRowEventArgs e)
{
//负责人
HyperLink FZR = e.Row.FindControl("FZR") as HyperLink;
if (FZR != null)
{
FZR.Text = Label1.Text;
}
}
<asp:Label ID="Label1" class="title_l" runat="server" Text="著作人姓名"></asp:Label>
<asp:GridView ID="gvInfo" runat="server" Width="100%" AutoGenerateColumns="False"
CssClass="list" BorderWidth="0" CellSpacing="1" onrowdatabound="gvInfo_RowDataBound">
<Columns>
<asp:TemplateField HeaderText="著作人姓名">
<ItemStyle HorizontalAlign="Center" />
<ItemTemplate>
<asp:HyperLink ID="FZR" runat="server" ForeColor="Blue"></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
后台:
protected void gvInfo_RowDataBound(object sender, GridViewRowEventArgs e)
{
//负责人
HyperLink FZR = e.Row.FindControl("FZR") as HyperLink;
if (FZR != null)
{
FZR.Text = Label1.Text;
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询