开发过程中遇到以下问题:

在前台JS给Gridview的某一列赋值后,后台直接调用【((TextBox)gRow.FindControl("txtXM")).Text】却取不到值!

这是可采取HiddenField进行后台cs的取值!

<asp:TextBox ID="txtID" runat="server" Text='<%# Eval("ID")%>'/>
<asp:HiddenField ID="hdID" runat="server" />

后台cs取值时:

((TextBox)gRow.FindControl("txtID")).Text //无法取到ID值

((HiddenField)gRow.FindControl("hdID")).Value //正确取值

  

 

 

相关文章:

  • 2021-07-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-14
  • 2022-12-23
  • 2022-12-23
  • 2021-10-21
  • 2022-12-23
相关资源
相似解决方案