473,323 Members | 1,589 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

Problem reading value form Gridview template field.

Hi,
I have the foll template field

<asp:TemplateField HeaderText="Quantity" ItemStyle-HorizontalAlign="center">
<ItemTemplate>
<%# Eval("quantity") %>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtQty" runat="server" Width="29"
Height="13" Text='<%# Eval("quantity") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>

I am able to read the EditItem by this

..Quantity = CType(r.Cells(e.RowIndex).FindControl("txtQty"), TextBox).Text

but when I try to read from the ItemTemplate like this

..Quantity = r.Cells(9).Text

I get Null or empty value. Please advice.

Thanks
Feb 1 '07 #1
2 17194
bpd
On Feb 1, 2:21 pm, Chris <C...@discussions.microsoft.comwrote:
Hi,
I have the foll template field

<asp:TemplateField HeaderText="Quantity" ItemStyle-HorizontalAlign="center">
<ItemTemplate>
<%# Eval("quantity") %>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtQty" runat="server" Width="29"
Height="13" Text='<%# Eval("quantity") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>

I am able to read the EditItem by this

.Quantity = CType(r.Cells(e.RowIndex).FindControl("txtQty"), TextBox).Text

but when I try to read from the ItemTemplate like this

.Quantity = r.Cells(9).Text

I get Null or empty value. Please advice.

Thanks
I believe you need Quantity = r.Cells(9).Controls(1).Text

Feb 1 '07 #2
Ah ha....thanks.

"bpd" wrote:
On Feb 1, 2:21 pm, Chris <C...@discussions.microsoft.comwrote:
Hi,
I have the foll template field

<asp:TemplateField HeaderText="Quantity" ItemStyle-HorizontalAlign="center">
<ItemTemplate>
<%# Eval("quantity") %>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtQty" runat="server" Width="29"
Height="13" Text='<%# Eval("quantity") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>

I am able to read the EditItem by this

.Quantity = CType(r.Cells(e.RowIndex).FindControl("txtQty"), TextBox).Text

but when I try to read from the ItemTemplate like this

.Quantity = r.Cells(9).Text

I get Null or empty value. Please advice.

Thanks

I believe you need Quantity = r.Cells(9).Controls(1).Text

Feb 1 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: hammad.awan_nospam | last post by:
Hello, I am using ASP.NET 2.0. What I have done is nested a gridview inside another column of a gridview using a template data field column declaritively in my web form. Inside this child...
1
by: Miguel Dias Moura | last post by:
Hello, I have a GridView in my page which is created in runtime. It works fine. My page has 2 Asp Buttons: - The HIDE button makes GridView.Visible = False; - The SHOW button makes...
0
by: Yog | last post by:
Hi, How to access the value of a Texbox column(Template field) in gridview and to update a column next to it in the Gridview...! Example:Let's say there are four columns Product,Cost,Quantity...
2
by: Will Winn | last post by:
I have a gridview template field that I would like to get the value of during the RowEditing event, but can't figure out how. Here's an example of how I get the value of a cell for the row being...
2
by: DC | last post by:
The Code <%@ import namespace="System" %> <%@ import namespace="System.Web" %> <%@ import namespace="System.Web.UI" %> <%@ import namespace="System.Web.UI.HtmlControls" %> <%@ import...
3
by: shapper | last post by:
Hello, In my GridView I have a HyperLink Field where I set the DataNavigateUrlFormaString MyHyperLinkField.DataNavigateUrlFormatString = "~\RSS.ashx?Channel={0}&Culture=" &...
4
by: =?Utf-8?B?QmFidU1hbg==?= | last post by:
Hi, I have a GridView and a SqlDataSource controls on a page. The SqlDataSource object uses stored procedures to do the CRUD operations. The DataSource has three columns one of which -...
0
by: Pemmavasu | last post by:
Hi All, I am not able to read the values from Gridview TemplateField Controls. basically I craeted a gridview with four colums and finally i added a Template field to it. The templatefield...
11
by: Ed Dror | last post by:
Hi there, I'm using ASP.NET 2.0 and SQL Server 2005 with VS 2005 Pro. I have a Price page (my website require login) with GridView with the following columns PriceID, Amount, Approved,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.