Help with FindControl method

G

Guest

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.CloseConnection)
'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").ToString())
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>
 
J

John Saunders

Joe said:
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
 
G

Guest

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
 
S

Scott Allen

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/

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.CloseConnection)
'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").ToString())
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>
 
G

Guest

Before posting this message, I read your article. But don't know where I am
making a mistake. Since I am a beginner, I am not able to spot the problem.

Joe

Scott Allen said:
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/

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.CloseConnection)
'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").ToString())
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>
 
J

John Saunders

Joe said:
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, didn't you have a txtFirstName control inside of a template column? If
so, then that control is repeated once per row of the data grid.

If you run your page and then use View Source in IE, you'll see what I mean.
Search in the source for "txtFirstName", and you'll find several different
controls with that in their name.


Joe, you never said which event you're in. When are you trying to access
this control? That will help us show you how to do it properly, as some
events give you more help than others. Events like ItemCommand supply you
the DataGridItem (the row) in e.Item. You can then try

e.Item.FindControl("txtFirstName")

to get the txtFirstName in that row.

John Saunders
 
G

Guest

Hey John,

One one page I gave a datagrid and which shows say ten records from MS
Access DB. Then when I select a particular record to edi. Insted of editing
the record in the table, I go to another page on which only the selected
record display. This is the page I am having trouble with. In my first post I
posted my entire code if you want to have a look.

The buttons "Save Changes" and "Cancel" are outside the dataGrid. So when
"Save Changes" button is clicked, onClick even calls SavRec sub.

Here is the main part of my code. Hopefully this will help you spot the
mistake I am making,

<form id="Form1" method="post" runat="server">
<asp:datagrid id="myDataGrid"
runat="server"
ItemStyle-Font-Size="x-small"
HeaderStyle-Font-Bold="True"
HeaderStyle-Font-Size="x-small"
Cellpadding="4"
BorderWidth="1"
AutoGenerateColumns="False"
BorderStyle="Solid"
GridLines="Horizontal"
BorderColor=""
Font-Names="Verdana,Arial,sans-serif"
Font-Size="11px"
HorizontalAlign="center"
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">ID</td><td><%# Container.DataItem("ID")%></td></tr>
<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">company</td><td><asp:TextBox id="txtCompany"
runat="server" Width="109px" Text='<%# Container.DataItem("company")%>'
/></td></tr>
<tr><td valign="top">street_address</td><td><asp:TextBox
id="txtStreetAddres" runat="server" Width="109px" Text='<%#
Container.DataItem("street_address")%>' /></td></tr>
<tr><td valign="top">address2</td><td><asp:TextBox id="txtAddres2"
runat="server" Width="109px" Text='<%# Container.DataItem("address2")%>'
/></td></tr>
<tr><td valign="top">city</td><td><asp:TextBox id="txtCity" runat="server"
Width="109px" Text='<%# Container.DataItem("city")%>' /></td></tr>
<tr><td valign="top">state</td><td><asp:TextBox id="txtState" runat="server"
Width="109px" Text='<%# Container.DataItem("state")%>' /></td></tr>
<tr><td valign="top">country</td><td><asp:TextBox id="txtCountry"
runat="server" Width="109px" Text='<%# Container.DataItem("country")%>'
/></td></tr>
<tr><td valign="top">postal</td><td><asp:TextBox id="txtPostal"
runat="server" Width="109px" Text='<%# Container.DataItem("postal")%>'
/></td></tr>
<tr><td valign="top">phone</td><td><asp:TextBox id="txtPhone" runat="server"
Width="109px" Text='<%# Container.DataItem("phone")%>' /></td></tr>
<tr><td valign="top">mobile</td><td><asp:TextBox id="txtMobile"
runat="server" Width="109px" Text='<%# Container.DataItem("mobile")%>'
/></td></tr>
<tr><td valign="top">email</td><td><asp:TextBox id="txtEmail" runat="server"
Width="109px" Text='<%# Container.DataItem("email")%>' /></td></tr>
<tr><td valign="top">password</td><td><asp:TextBox id="txtPassword"
runat="server" Width="109px" Text='<%# Container.DataItem("password")%>'
/></td></tr>
<tr><td valign="top">AddDate</td><td><asp:TextBox id="txtAddDate"
runat="server" Width="109px" Text='<%# Container.DataItem("AddDate")%>'
/></td></tr>
<tr><td valign="top">investor</td><td><asp:TextBox id="txtInvestor"
runat="server" Width="109px" Text='<%# Container.DataItem("investor")%>'
/></td></tr>
<tr><td valign="top">ViewDate</td><td><%#
Container.DataItem("ViewDate")%></td></tr>
<tr><td valign="top">RemoteIP</td><td><%#
Container.DataItem("RemoteIP")%></td></tr>
<tr><td valign="top">Cookie</td><td><%#
Container.DataItem("Cookie")%></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="SPS" Runat="Server" />--<asp:Label TEXT=""
ID="pi" Runat="Server" />--<asp:Label TEXT="" ID="here" Runat="Server"
/>--<asp:Label TEXT="" ID="Label2" Runat="Server" />

</form>

Thanks John,

Joe
 
J

John Saunders

Joe said:
Hey John,

One one page I gave a datagrid and which shows say ten records from MS
Access DB. Then when I select a particular record to edi. Insted of
editing
the record in the table, I go to another page on which only the selected
record display. This is the page I am having trouble with. In my first
post I
posted my entire code if you want to have a look.

The buttons "Save Changes" and "Cancel" are outside the dataGrid. So when
"Save Changes" button is clicked, onClick even calls SavRec sub.

Here is the main part of my code. Hopefully this will help you spot the
mistake I am making,

<form id="Form1" method="post" runat="server">
<asp:datagrid id="myDataGrid"
runat="server"
ItemStyle-Font-Size="x-small"
HeaderStyle-Font-Bold="True"
HeaderStyle-Font-Size="x-small"
Cellpadding="4"
BorderWidth="1"
AutoGenerateColumns="False"
BorderStyle="Solid"
GridLines="Horizontal"
BorderColor=""
Font-Names="Verdana,Arial,sans-serif"
Font-Size="11px"
HorizontalAlign="center"
width="80%" >

Is this DataGrid on the first page or the second?

In either case, it's still a DataGrid. Even if it only displays a single
row, it is a DataGrid.

You should try myDataGrid.Items(0).FindControl("txtFirstName").

John Saunders
 
G

Guest

Yes John. It worked. Can you explain why did you use Items(0)? Is it because
there is only one datagrid on the page?
Thanks again. I spent days on finding the problem and you solved it. You
are great.

Joe
 
J

John Saunders

Joe said:
Yes John. It worked. Can you explain why did you use Items(0)? Is it
because
there is only one datagrid on the page?
Thanks again. I spent days on finding the problem and you solved it. You
are great.

It's not because there's only one DataGrid, it's because you told me that
there was only one item. At least you implied this.

You said that you have one page with a DataGrid, and that this grid displays
multiple rows. You said that when one of the rows was clicked, a second page
is displayed which only shows one row.

This second page contains the DataGrid you showed us. Because it's only
displaying a single row, I figured it would only have one Item - (0).

John Saunders
 
G

Guest

Thanks for explaining John.

Joe


John Saunders said:
It's not because there's only one DataGrid, it's because you told me that
there was only one item. At least you implied this.

You said that you have one page with a DataGrid, and that this grid displays
multiple rows. You said that when one of the rows was clicked, a second page
is displayed which only shows one row.

This second page contains the DataGrid you showed us. Because it's only
displaying a single row, I figured it would only have one Item - (0).

John Saunders
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top