473,789 Members | 2,925 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem reading value form Gridview template field.

Hi,
I have the foll template field

<asp:TemplateFi eld HeaderText="Qua ntity" ItemStyle-HorizontalAlign ="center">
<ItemTemplate >
<%# Eval("quantity" ) %>
</ItemTemplate>
<EditItemTempla te>
<asp:TextBox ID="txtQty" runat="server" Width="29"
Height="13" Text='<%# Eval("quantity" ) %>'></asp:TextBox>
</EditItemTemplat e>
</asp:TemplateFie ld>

I am able to read the EditItem by this

..Quantity = CType(r.Cells(e .RowIndex).Find Control("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 17211
bpd
On Feb 1, 2:21 pm, Chris <C...@discussio ns.microsoft.co mwrote:
Hi,
I have the foll template field

<asp:TemplateFi eld HeaderText="Qua ntity" ItemStyle-HorizontalAlign ="center">
<ItemTemplate >
<%# Eval("quantity" ) %>
</ItemTemplate>
<EditItemTempla te>
<asp:TextBox ID="txtQty" runat="server" Width="29"
Height="13" Text='<%# Eval("quantity" ) %>'></asp:TextBox>
</EditItemTemplat e>
</asp:TemplateFie ld>

I am able to read the EditItem by this

.Quantity = CType(r.Cells(e .RowIndex).Find Control("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).Cont rols(1).Text

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

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

<asp:TemplateFi eld HeaderText="Qua ntity" ItemStyle-HorizontalAlign ="center">
<ItemTemplate >
<%# Eval("quantity" ) %>
</ItemTemplate>
<EditItemTempla te>
<asp:TextBox ID="txtQty" runat="server" Width="29"
Height="13" Text='<%# Eval("quantity" ) %>'></asp:TextBox>
</EditItemTemplat e>
</asp:TemplateFie ld>

I am able to read the EditItem by this

.Quantity = CType(r.Cells(e .RowIndex).Find Control("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).Cont rols(1).Text

Feb 1 '07 #3

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

Similar topics

0
2211
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 gridview I have set an ItemStyle property of width 20% for the first templated field which contains a hyperlink control, and an ItemStyle of width 80% for the second templated field which contains a label. Both of these controls are databound to...
1
9357
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 GridView.Visible = True. I press HIDE and the GridView disappears as expected. After it I press SHOW and the GridView doesn't show.
0
1498
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 Required(Textbox type template field in Gridview) and Total...! Totla shud get updated by Cost*QuantityRequired as soon as the user focuses on next row in the gridview.....!
2
13968
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 edited: Dim WasherNum As String = gvBrazeLoad.Rows(e.NewEditIndex).Cells(6).Text It works if the Cell is databount, but it doesn't work for a template field. How do I do it?
2
2962
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 namespace="System.Web.UI.WebControls" %> <%@ import namespace="System.Data" %> <%@ import namespace="System.Data.OleDb" %>
3
3066
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=" & System.Threading.Thread.CurrentThread.CurrentCulture.ToString() I believe {0} retrieves the value of my datasource column with index 0.
4
7254
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 - "Modified" of type DateTime - is hidden since it should not be edited by a user. The system handles the update for this column. So, I have hidden (Visible=false) this column on the grid. In order to access the value in this field, I have created a...
0
1208
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 contains 3 labels and one button while i am clicking on this button. i am getting a error message Error "Object reference not set to an instance of an object" - .NET VB
11
4081
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, CrtdUser and Date And Edit and Delete buttons
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10410
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10139
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9984
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5418
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4093
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.