帮助FindControl方法 [英] Help with FindControl method

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

问题描述




尝试使用FindControl()但在这个该死的文本框中没有运气

有id txtFirstName。有人可以用这种方法帮助我吗?


这就是我一直在做的但是它不起作用,


Dim txtFName As TextBox


txtFName = CType(myDataGrid.FindControl(" txtFirstName"),TextBox)

如果不是(txtFName什么都没有)那么

Label2.Text = txtFName.Text

Else

Label2.Text =" Control Not Found"

结束如果


感谢您的帮助。


Joe


这是我的代码:


<%@ Page Language =" VB"调试= QUOT;真" %>

<%@ Import Namespace =" System.Data" %>

<%@ Import Namespace =" System.Data.OleDb" %>

<! - #include file = dsn.aspx - >


< script language =" VB" RUNAT = QUOT;服务器" >


Sub Page_Load(ByVal sender As System.Object,ByVal e As

System.EventArgs)处理MyBase.Load

如果不是Page.IsPostBack那么

''保存推荐人Url

ViewState(" ReferrerUrl")= Request.UrlReferrer.ToString()

BindData()

结束如果

结束Sub


Sub BindData()

dim strsql as string

''检查一个id

如果Request.QueryString.Item(" id")是Nothing那么

响应。 redirect(" Resultslist.aspx")

Else

strsql =" select * from [Results]其中[ID] =" &

request.querystring(" id")

结束如果

''创建连接字符串

将connString称为字符串

connString = getdsn()


''打开连接

将objConnection调暗为OleDbConnection

objConnection =新的OleDbConnection(connString)

objConnection.Open()


''创建一个命令对象

Dim objCommand as OleDbCommand

objCommand = New OleDbCommand(strSQL,objConnection)

''获取数据加载器

Dim objDataReader as OleDbDataReader

objDataReader =

objCommand.ExecuteReader(CommandBehavior.CloseConn ection)

''做DataBinding

myDataGrid.DataSource = objDataReader

myDataGrid.DataBind()


''关闭datareader / db连接

objDataReader.Close()

End Sub


Sub saveRec(Sender As Object,e As System.EventArgs)
dim strSQL as string

''检查id

如果Request.QueryString.Item(" id")是Nothing Then

response.redirect(" Resultslist.aspx")

Else

strSQL ="更新结果集first_name = @ fn,last_name = @ ln ,

city = @ ct其中ID =" &安培; request.querystring(" id")

结束如果

''创建一个连接字符串

Dim connString as String

connString = getdsn()


''打开一个连接

Dim objConnection as OleDbConnection

objConnection = New OleDbConnection( connString)

objConnection.Open()


''创建一个命令对象

Dim objCommand as OleDbCommand

objCommand =新的OleDbCommand(strSQL,objConnection)

objCommand.Parameters.Add(" @ fn",OleDbType.VarChar,255)

objCommand.Parameters.Add(" @ ln",OleDbType.VarChar,255)

objCommand.Parameters.Add(" @ ct",OleDbType.VarChar,255)


objCommand.Parameters(" @ fn")。Value = txtFirstName.Text

objCommand.Parameters(" @ ln")。Value = txtLastName.Text

objCommand.Parameters(" @ ct")。Value = txtCity.Text


试试

Dim txtFName As TextBox


txtFName = CType(myDataGrid.FindControl(" txtFirstName"),TextBox)

If Not(txtFName Is Nothing )然后

Label2.Text = txtFName.Text Else

Label2.Text = txtFName.Text''" Control Not Found"

End如果


Catch Ex as Exception

Response.Write("< p>< strong>发生错误:< / strong> " &安培; Ex.ToString()

& "< / p为H." &安培; vbCrLf)

最后

objConnection.Close()


结束尝试


结束子


子取消(发件人作为对象,e作为EventArgs)

Response.Redirect(ViewState(" ReferrerUrl")。ToStrin g())

结束子


< / script>

< body>

< html> ;

< head>

< title> Untitled< / title>

< / head>

< body>

< form id =" Form1"方法= QUOT;交" runat =" server">

< asp:datagrid id =" myDataGrid"

runat =" server"

AutoGenerateColumns =" False"

width =" 80%">

< ItemStyle Font-Size =" X-Small">< / ItemStyle> ;

< HeaderStyle字体大小=" X-Small"字体-粗体="真" ForeColor =" White"

BackColor ="">< / HeaderStyle>


< Columns>

< asp:TemplateColumn>

< HeaderTemplate>

< b>结果详情< / b>

< / HeaderTemplate>

< ItemTemplate>

< table border =" 0" CELLPADDING = QUOT; 4英寸CELLSPACING = QUOT; 0" Width =" 80%"

style =" FONT-SIZE:11px; FONT-FAMILY:Verdana,Arial,sans-serif">

< tr>< td valign =" top" unselectable =" on"> first_name< / td>

< td>< asp:TextBox id =" txtFirstName" RUNAT = QUOT;服务器"宽度= QUOT; 109px" Text =''<%#

Container.DataItem(" first_name")%>''/>< / td>

< / tr> ;

< tr>< td valign =" top"> last_name< / td>< td>< asp:TextBox id =" txtLastName"

runat =" server"宽度= QUOT; 109px" Text =''<%#Container.DataItem(" last_name")%>''

/>< / td>< / tr>

< tr>< td valign =" top"> city< / td>< td>< asp:TextBox id =" txtCity" runat =" server"

Width =" 109px" Text =''<%#Container.DataItem(" city")%>''/>< / td>< / tr>

< / table>

< / ItemTemplate>

< / asp:TemplateColumn>

< / Columns>

< / asp:datagrid>

< br />

< asp:Button ID =" updateBtn" RUNAT = QUOT;服务器"文字=保存更改

onclick =" saveRec" />

< asp:Button ID =" cancelBtn" RUNAT = QUOT;服务器" Text =" Cancel"

onclick =" cancel" />

< asp:Label TEXT ="" ID = QUOT; Label2的" RUNAT = QUOT;服务器" />


< / form>

< / center>

< / body>

< / html>

解决方案

" Joe" < Jo*@discussions.microsoft.com>在消息中写道

news:6E ********************************** @ microsof t.com ...



尝试使用FindControl(),但在这个该死的文本框中没有运气,有id txtFirstName。有人可以用这种方法帮助我吗?

这就是我一直在做的但是它不起作用,

Dim txtFName As TextBox
txtFName = CType(myDataGrid.FindControl(" txtFirstName"),
TextBox)
如果不是(txtFName什么都没有)那么
Label2.Text = txtFName.Text
Else < br> Label2.Text =" Control Not Found"
结束如果




你不是在datagrid中有多个txtFirstName吗?每行一个?


另外,你想在哪个活动中这样做?


John Saunders


我只有一个txtFirstName控件,我试图引用这个

控件及它在saveRec子中的文本值。


Joe


" John Saunders"写道:

" Joe" < Jo*@discussions.microsoft.com>在消息中写道
新闻:6E ********************************** @ microsof t.com。 ..



尝试使用FindControl(),但是在这个该死的文本框中没有运气,有id txtFirstName。有人可以用这种方法帮助我吗?

这就是我一直在做的但是它不起作用,

Dim txtFName As TextBox
txtFName = CType(myDataGrid.FindControl(" txtFirstName"),
TextBox)
如果不是(txtFName什么都没有)那么
Label2.Text = txtFName.Text
Else < br> Label2.Text =" Control Not Found"
结束如果



你不是在datagrid中有多个txtFirstName吗?每行一个吗?

此外,您在哪个活动中尝试这样做?

John Saunders



我有一篇关于在网格中找到控件的解释和代码的文章:

http://odetocode.com/Articles/116.aspx


-

Scott
http:// www。 OdeToCode.com/blogs/scott/

2004年12月21日星期二11:07:03 -0800,乔

< Jo *@discussions.microsoft.com>写道:



尝试使用FindControl(),但在这个该死的文本框中没有运气
有id txtFirstName。有人可以用这种方法帮助我吗?

这就是我一直在做的但是它不起作用,

Dim txtFName As TextBox
txtFName = CType(myDataGrid.FindControl(" txtFirstName"),TextBox)
如果不是(txtFName什么都没有)那么
Label2.Text = txtFName.Text
否则
Label2 .Text =未找到控件
结束如果

感谢您的帮助。

Joe

这是我的代码:

<%@ Page Language =" VB"调试= QUOT;真" %>
<%@ Import Namespace =" System.Data" %>
<%@ Import Namespace =" System.Data.OleDb" %>
<! - #include file = dsn.aspx - >

< script language =" VB" RUNAT = QUOT;服务器" >

Sub Page_Load(ByVal sender As System.Object,ByVal e As
System.EventArgs)处理MyBase.Load
如果不是Page.IsPostBack那么
' '保存引荐人Url
ViewState(" ReferrerUrl")= Request.UrlReferrer.ToString()
BindData()
结束如果
结束子
Sub BindData()
dim strsql as string
''检查id
如果Request.QueryString.Item(" id")则Nothing Then
response.redirect( Resultslist.aspx)
其他
strsql =" select * from [Results]其中[ID] =" &
request.querystring(" id")
结束如果
''创建一个连接字符串
Dim connString as String
connString = getdsn()

''打开一个连接
Dim objConnection as OleDbConnection
objConnection = New OleDbConnection(connString)
objConnection.Open()

''创建命令对象
Dim objCommand as OleDbCommand
objCommand = New OleDbCommand(strSQL,objConnection)
''获取数据加载器
Dim objDataReader as OleDbDataReader
objDataReader =
objCommand.ExecuteReader(CommandBehavior.CloseConction)
''做DataBinding
myDataGrid.DataSource = objDataReader
myDataGrid.DataBind()

''关闭datareader / db连接
objDataReader.Close()
结束Sub

Sub saveRec(发件人为对象,e为Syste) m.EventArgs)
dim strSQL as string
''检查id
如果Request.QueryString.Item(" id")是Nothing Then
response.redirect(" ; Resultslist.aspx")
其他
strSQL ="更新结果集first_name = @ fn,last_name = @ ln,
city = @ ct其中ID =" &安培; request.querystring(" id")
结束如果
''创建一个连接字符串
Dim connString as String
connString = getdsn()

''打开一个连接
Dim objConnection as OleDbConnection
objConnection = New OleDbConnection(connString)
objConnection.Open()

''创建一个命令对象
Dim objCommand as OleDbCommand
objCommand = New OleDbCommand(strSQL,objConnection)

objCommand.Parameters.Add(" @ fn",OleDbType.VarChar,255)
objCommand。 Parameters.Add(" @ ln",OleDbType.VarChar,255)
objCommand.Parameters.Add(" @ ct",OleDbType.VarChar,255)

objCommand.Parameters( " @ fn")。Value = txtFirstName.Text
objCommand.Parameters(" @ ln")。Value = txtLastName.Text
objCommand.Parameters(" @ ct")。Value = txtCity .Tex尝试
Dim txtFName作为TextBox

txtFName = CType(myDataGrid.FindControl(" txtFirstName"),TextBox)
如果不是(txtFName)什么都没有)然后
Label2.Text = txtFName.Text Else
Label2.Text = txtFName.Text''" Control Not Found"
结束如果

Catch Ex as Exception
Response.Write("< p>< strong>发生错误:< / strong> " &安培; Ex.ToString()
& "< / p为H." &安培; vbCrLf)
最后
objConnection.Close()

结束尝试

结束子

子取消(发件人为对象) ,e作为EventArgs)
Response.Redirect(ViewState(" ReferrerUrl")。ToStrin g())
End Sub

< / script>
< ; body>
< html>
< head>
< title>无标题< / title>
< / head>
< body>
< form id =" Form1"方法= QUOT;交" runat =" server">
< asp:datagrid id =" myDataGrid"
runat =" server"
AutoGenerateColumns =" False"
width =" ; 80%>>
< ItemStyle Font-Size =" X-Small">< / ItemStyle>
< HeaderStyle Font-Size =" X-Small"字体-粗体="真" ForeColor =""
BackColor ="">< / HeaderStyle>

<列>
< asp:TemplateColumn>
< ; HeaderTemplate>
< b>结果详细信息< / b>
< / HeaderTemplate>
< ItemTemplate>
< table border =" 0" CELLPADDING = QUOT; 4英寸CELLSPACING = QUOT; 0"宽度=80%
style =" FONT-SIZE:11px; FONT-FAMILY:Verdana,Arial,sans-serif">
< tr>< td valign =" top" unselectable =" on"> first_name< / td>
< td>< asp:TextBox id =" txtFirstName" RUNAT = QUOT;服务器"宽度= QUOT; 109px" Text =''<%#
Container.DataItem(" first_name")%>''/>< / td>
< / tr>
< tr> ;< td valign =" top"> last_name< / td>< td>< asp:TextBox id =" txtLastName"
runat =" server"宽度= QUOT; 109px" Text =''<%#Container.DataItem(" last_name")%>''
/>< / td>< / tr>
< tr>< td valign =" top"> city< / td>< td>< asp:TextBox id =" txtCity" runat =" server"
Width =" 109px" Text =''<%#Container.DataItem(" city")%>''/>< / td>< / tr>
< / table>
< / ItemTemplate>
< / asp:TemplateColumn>
< / Columns>
< / asp:datagrid>
< br />
< asp:Button ID =" updateBtn" RUNAT = QUOT;服务器" Text =" Save Changes"
onclick =" saveRec" />
< asp:Button ID =" cancelBtn" RUNAT = QUOT;服务器" Text =" Cancel"
onclick =" cancel" />
< asp:标签TEXT ="" ID = QUOT; Label2的" RUNAT = QUOT;服务器" />

< / form>
< / center>
< / body>
< / html>



Hi,

Tried using the FindControl() but no luck in finidng this damn textbox
having id txtFirstName. Can someone help me with this method?

This is what I have been doing but it doesn''t work,

Dim txtFName As TextBox

txtFName = CType(myDataGrid.FindControl("txtFirstName"), TextBox)
If Not (txtFName Is Nothing) Then
Label2.Text = txtFName.Text
Else
Label2.Text = "Control Not Found"
End If

Thank you for your help.

Joe

Here is my code:

<%@ Page Language="VB" Debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<!-- #include file=dsn.aspx -->

<script language="VB" runat="server" >

Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
'' Save the referrer Url
ViewState("ReferrerUrl") = Request.UrlReferrer.ToString()
BindData()
End If
End Sub

Sub BindData()
dim strsql as string
''check for an id
If Request.QueryString.Item("id") Is Nothing Then
response.redirect("Resultslist.aspx")
Else
strsql="select * from [Results] where [ID]=" &
request.querystring("id")
End If
''Create a connection string
Dim connString as String
connString = getdsn()

''Open a connection
Dim objConnection as OleDbConnection
objConnection = New OleDbConnection(connString)
objConnection.Open()

''Create a command object
Dim objCommand as OleDbCommand
objCommand = New OleDbCommand(strSQL, objConnection)
''Get a datareader
Dim objDataReader as OleDbDataReader
objDataReader =
objCommand.ExecuteReader(CommandBehavior.CloseConn ection)
''Do the DataBinding
myDataGrid.DataSource = objDataReader
myDataGrid.DataBind()

''Close the datareader/db connection
objDataReader.Close()
End Sub

Sub saveRec(Sender As Object, e As System.EventArgs)
dim strSQL as string
''check for an id
If Request.QueryString.Item("id") Is Nothing Then
response.redirect("Resultslist.aspx")
Else
strSQL="Update Results set first_name=@fn, last_name=@ln,
city=@ct where ID=" & request.querystring("id")
End If
''Create a connection string
Dim connString as String
connString = getdsn()

''Open a connection
Dim objConnection as OleDbConnection
objConnection = New OleDbConnection(connString)
objConnection.Open()

''Create a command object
Dim objCommand as OleDbCommand
objCommand = New OleDbCommand(strSQL, objConnection)

objCommand.Parameters.Add("@fn", OleDbType.VarChar, 255)
objCommand.Parameters.Add("@ln", OleDbType.VarChar, 255)
objCommand.Parameters.Add("@ct", OleDbType.VarChar, 255)

objCommand.Parameters("@fn").Value = txtFirstName.Text
objCommand.Parameters("@ln").Value = txtLastName.Text
objCommand.Parameters("@ct").Value = txtCity.Text

Try
Dim txtFName As TextBox

txtFName = CType(myDataGrid.FindControl("txtFirstName"), TextBox)
If Not (txtFName Is Nothing) Then
Label2.Text = txtFName.Text Else
Label2.Text = txtFName.Text ''"Control Not Found"
End If

Catch Ex as Exception
Response.Write("<p><strong>An Error Occurred:</strong> " & Ex.ToString()
& "</p>" & vbCrLf)
Finally
objConnection.Close()

End Try

End Sub

Sub cancel(Sender As Object, e As EventArgs)
Response.Redirect(ViewState("ReferrerUrl").ToStrin g())
End Sub

</script>
<body>
<html>
<head>
<title>Untitled</title>
</head>
<body>
<form id="Form1" method="post" runat="server">
<asp:datagrid id="myDataGrid"
runat="server"
AutoGenerateColumns="False"
width="80%">
<ItemStyle Font-Size="X-Small"></ItemStyle>
<HeaderStyle Font-Size="X-Small" Font-Bold="True" ForeColor="White"
BackColor=""></HeaderStyle>

<Columns>
<asp:TemplateColumn>
<HeaderTemplate>
<b>Results detail</b>
</HeaderTemplate>
<ItemTemplate>
<table border="0" Cellpadding="4" Cellspacing="0" Width="80%"
style="FONT-SIZE: 11px; FONT-FAMILY: Verdana, Arial, sans-serif">
<tr><td valign="top" unselectable="on">first_name</td>
<td><asp:TextBox id="txtFirstName" runat="server" Width="109px" Text=''<%#
Container.DataItem("first_name")%>'' /></td>
</tr>
<tr><td valign="top">last_name</td><td><asp:TextBox id="txtLastName"
runat="server" Width="109px" Text=''<%# Container.DataItem("last_name")%>''
/></td></tr>
<tr><td valign="top">city</td><td><asp:TextBox id="txtCity" runat="server"
Width="109px" Text=''<%# Container.DataItem("city")%>'' /></td></tr>
</table>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
<br />
<asp:Button ID="updateBtn" Runat="server" Text="Save Changes"
onclick="saveRec" />
<asp:Button ID="cancelBtn" Runat="server" Text="Cancel"
onclick="cancel" />
<asp:Label TEXT="" ID="Label2" Runat="Server" />

</form>
</center>
</body>
</html>


解决方案

"Joe" <Jo*@discussions.microsoft.com> wrote in message
news:6E**********************************@microsof t.com...

Hi,

Tried using the FindControl() but no luck in finidng this damn textbox
having id txtFirstName. Can someone help me with this method?

This is what I have been doing but it doesn''t work,

Dim txtFName As TextBox

txtFName = CType(myDataGrid.FindControl("txtFirstName"),
TextBox)
If Not (txtFName Is Nothing) Then
Label2.Text = txtFName.Text
Else
Label2.Text = "Control Not Found"
End If



Don''t you have more than one txtFirstName in the datagrid? One per row?

Also, in which event are you trying to do this?

John Saunders


I have only one txtFirstName control and I am trying to get reference to this
control and it''s text value in saveRec sub.

Joe

"John Saunders" wrote:

"Joe" <Jo*@discussions.microsoft.com> wrote in message
news:6E**********************************@microsof t.com...

Hi,

Tried using the FindControl() but no luck in finidng this damn textbox
having id txtFirstName. Can someone help me with this method?

This is what I have been doing but it doesn''t work,

Dim txtFName As TextBox

txtFName = CType(myDataGrid.FindControl("txtFirstName"),
TextBox)
If Not (txtFName Is Nothing) Then
Label2.Text = txtFName.Text
Else
Label2.Text = "Control Not Found"
End If



Don''t you have more than one txtFirstName in the datagrid? One per row?

Also, in which event are you trying to do this?

John Saunders



I have an article with explanation and code on finding controls inside
of a grid:

http://odetocode.com/Articles/116.aspx

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Tue, 21 Dec 2004 11:07:03 -0800, Joe
<Jo*@discussions.microsoft.com> wrote:

Hi,

Tried using the FindControl() but no luck in finidng this damn textbox
having id txtFirstName. Can someone help me with this method?

This is what I have been doing but it doesn''t work,

Dim txtFName As TextBox

txtFName = CType(myDataGrid.FindControl("txtFirstName"), TextBox)
If Not (txtFName Is Nothing) Then
Label2.Text = txtFName.Text
Else
Label2.Text = "Control Not Found"
End If

Thank you for your help.

Joe

Here is my code:

<%@ Page Language="VB" Debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<!-- #include file=dsn.aspx -->

<script language="VB" runat="server" >

Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
'' Save the referrer Url
ViewState("ReferrerUrl") = Request.UrlReferrer.ToString()
BindData()
End If
End Sub

Sub BindData()
dim strsql as string
''check for an id
If Request.QueryString.Item("id") Is Nothing Then
response.redirect("Resultslist.aspx")
Else
strsql="select * from [Results] where [ID]=" &
request.querystring("id")
End If
''Create a connection string
Dim connString as String
connString = getdsn()

''Open a connection
Dim objConnection as OleDbConnection
objConnection = New OleDbConnection(connString)
objConnection.Open()

''Create a command object
Dim objCommand as OleDbCommand
objCommand = New OleDbCommand(strSQL, objConnection)
''Get a datareader
Dim objDataReader as OleDbDataReader
objDataReader =
objCommand.ExecuteReader(CommandBehavior.CloseCon nection)
''Do the DataBinding
myDataGrid.DataSource = objDataReader
myDataGrid.DataBind()

''Close the datareader/db connection
objDataReader.Close()
End Sub

Sub saveRec(Sender As Object, e As System.EventArgs)
dim strSQL as string
''check for an id
If Request.QueryString.Item("id") Is Nothing Then
response.redirect("Resultslist.aspx")
Else
strSQL="Update Results set first_name=@fn, last_name=@ln,
city=@ct where ID=" & request.querystring("id")
End If
''Create a connection string
Dim connString as String
connString = getdsn()

''Open a connection
Dim objConnection as OleDbConnection
objConnection = New OleDbConnection(connString)
objConnection.Open()

''Create a command object
Dim objCommand as OleDbCommand
objCommand = New OleDbCommand(strSQL, objConnection)

objCommand.Parameters.Add("@fn", OleDbType.VarChar, 255)
objCommand.Parameters.Add("@ln", OleDbType.VarChar, 255)
objCommand.Parameters.Add("@ct", OleDbType.VarChar, 255)

objCommand.Parameters("@fn").Value = txtFirstName.Text
objCommand.Parameters("@ln").Value = txtLastName.Text
objCommand.Parameters("@ct").Value = txtCity.Text

Try
Dim txtFName As TextBox

txtFName = CType(myDataGrid.FindControl("txtFirstName"), TextBox)
If Not (txtFName Is Nothing) Then
Label2.Text = txtFName.Text Else
Label2.Text = txtFName.Text ''"Control Not Found"
End If

Catch Ex as Exception
Response.Write("<p><strong>An Error Occurred:</strong> " & Ex.ToString()
& "</p>" & vbCrLf)
Finally
objConnection.Close()

End Try

End Sub

Sub cancel(Sender As Object, e As EventArgs)
Response.Redirect(ViewState("ReferrerUrl").ToStrin g())
End Sub

</script>
<body>
<html>
<head>
<title>Untitled</title>
</head>
<body>
<form id="Form1" method="post" runat="server">
<asp:datagrid id="myDataGrid"
runat="server"
AutoGenerateColumns="False"
width="80%">
<ItemStyle Font-Size="X-Small"></ItemStyle>
<HeaderStyle Font-Size="X-Small" Font-Bold="True" ForeColor="White"
BackColor=""></HeaderStyle>

<Columns>
<asp:TemplateColumn>
<HeaderTemplate>
<b>Results detail</b>
</HeaderTemplate>
<ItemTemplate>
<table border="0" Cellpadding="4" Cellspacing="0" Width="80%"
style="FONT-SIZE: 11px; FONT-FAMILY: Verdana, Arial, sans-serif">
<tr><td valign="top" unselectable="on">first_name</td>
<td><asp:TextBox id="txtFirstName" runat="server" Width="109px" Text=''<%#
Container.DataItem("first_name")%>'' /></td>
</tr>
<tr><td valign="top">last_name</td><td><asp:TextBox id="txtLastName"
runat="server" Width="109px" Text=''<%# Container.DataItem("last_name")%>''
/></td></tr>
<tr><td valign="top">city</td><td><asp:TextBox id="txtCity" runat="server"
Width="109px" Text=''<%# Container.DataItem("city")%>'' /></td></tr>
</table>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
<br />
<asp:Button ID="updateBtn" Runat="server" Text="Save Changes"
onclick="saveRec" />
<asp:Button ID="cancelBtn" Runat="server" Text="Cancel"
onclick="cancel" />
<asp:Label TEXT="" ID="Label2" Runat="Server" />

</form>
</center>
</body>
</html>




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

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