日期:2014-05-19  浏览次数:20445 次

新手,那位可以帮一下?GridView中的修改问题!!在线等!!
在GridView中修改查询问题的时候怎么才可以缩小那个Textbox文本框啊?
      Dim   txtbj,   txtxm   As   TextBox
                txtbj   =   Me.GridView1.Rows(e.RowIndex).Cells(0).Controls(0)
                txtxm   =   Me.GridView1.Rows(e.RowIndex).Cells(1).Controls(0)
 
像下面这样改怎么不可以的!有什么好的方法不?可以告诉一下不?谢谢!!
  txtxm.Width   =   90
  txtsj.Width   =   90

------解决方案--------------------
txtbj = CType(e.FindControls( "TextBoxID "),TextBox)

------解决方案--------------------
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim txtbj, txtxm As TextBox
txtbj = Me.GridView1.Rows(e.RowIndex).Cells(0).Controls(0)
txtxm = Me.GridView1.Rows(e.RowIndex).Cells(1).Controls(0)

txtxm.Width = 90
txtsj.Width = 90


End If
End Sub