473,739 Members | 6,655 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unable to find control in Gridview

parshupooja
159 New Member
Hey All,
I have where I want to do some manipulations and show in other column but unable to find their values in RowDatabound event even though I have two records in gridview
Expand|Select|Wrap|Line Numbers
  1. <asp:GridView ID="GridView1" runat="server" ShowFooter="True" AutoGenerateColumns="false" Width="700px">
  2.         <Columns>
  3.                      <asp:TemplateField HeaderText="Qty">
  4.                         <EditItemTemplate>
  5.                             <asp:TextBox ID="TextBoxCode" runat="server" Width="20pt" Text='<%# Bind("Qty") %>'/>
  6.                         </EditItemTemplate>
  7.                         <ItemTemplate>
  8.                             <asp:Label ID="lblQty" runat="server" Text='<%# Eval("Qty") %>' />
  9.                         </ItemTemplate>
  10.                         <FooterTemplate>
  11.                             <asp:TextBox ID="TextQTY" runat="server" Width="20pt" Text='<%# Bind("Qty") %>'/>
  12.                         </FooterTemplate>
  13.                     </asp:TemplateField>                                
  14.                      <asp:TemplateField HeaderText="Unit Price">
  15.                       <EditItemTemplate>                            
  16.                         </EditItemTemplate>
  17.                         <ItemTemplate>
  18.                             <asp:Label ID="lblUnitCost" runat="server" Text='<%# Eval("UnitCost") %>' />
  19.                         </ItemTemplate>
  20.                         <FooterTemplate>
  21.                             <asp:Label ID="lblfooterUnitCost" runat="server" Text='<%# Eval("UnitCost") %>'/>
  22.                         </FooterTemplate>
  23.                     </asp:TemplateField>
  24.  <asp:TemplateField HeaderText="Line Total">
  25.                       <EditItemTemplate>
  26.  
  27.                         </EditItemTemplate>
  28.                         <ItemTemplate>
  29.                             <asp:Label ID="lbllinettl" runat="server" Text="" />
  30.                         </ItemTemplate>
  31.                         <FooterTemplate>
  32.                             <asp:Label ID="lblfooterLinePrice" runat="server" Text=""/>
  33.                         </FooterTemplate>
  34.                     </asp:TemplateField>
  35.                 </Columns>
  36.         </asp:GridView>     
  37.  
I want to do some calculations in gridview that is lbllinettl = lblUnitCost * lblQty
Here is my RowDAtaBound Event. I don't know why Qty is coming up blank

Expand|Select|Wrap|Line Numbers
  1. Protected Sub GridView1_RowDataBound(ByVal sender As Object,        If (e.Row.RowType = DataControlRowType.DataRow) Then ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
  2.  
  3.             Dim Qty As String
  4.             Qty = CType(e.Row.FindControl("lblQty"), Label).Text
  5.         End If
  6. end Sub
Thanks, Help appreciated
Jun 28 '09 #1
0 4186

Sign in to post your reply or Sign up for a free account.

Similar topics

7
14811
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I want to look at that data and filter it based on what is in it. I know that this could have been done with data sets and data views in asp.net 1.1 but how is this done now in asp.net 2.0?
3
17114
by: Dabbler | last post by:
I have a checkbox control in a GridView EditItemTemplate. My SqlDataAdapter complains when I try and use UpdateCommand Thanks on any binding clarification. GridView: <asp:TemplateField HeaderText="Active"> <ItemTemplate> <asp:CheckBox ID="ActiveCheckBox" runat="server" Checked='<%# Eval("Active") %>' />
2
8468
by: Sean | last post by:
I am using a GridView to display and edit rows of data. I am having problems with one of my GridViews that has a Calendar control in it. If the data coming back from the DB doesn't have a date for this field, I get a 'Specified Cast is Invalid' message when the empty string is being bound to the SelectedValue of the Calendar control. That makes sense. What I need to do (I think), is somehow intercept the process so that if I have a DB...
4
2603
by: Wannabe | last post by:
I am using ASP.Net 2.0 and have a gridview on my page. I have everything working except the delete command. The page reloads except the row I am trying to delete is still there. I believe it is something really easy, but I cannot see it. The stored procedue works when run in QA. Can someone tell me what I am doing wrong/missing that is keeping the delete command from working in the gridview? Thank you. I am trying to delete a row out of...
1
6132
by: sheenaa | last post by:
Hello Members, I m creating my application forms in ASP.Net 2005 C# using the backend SQL Server 2005. What i have used on forms :: ? On my first form i have used some label,textboxs,dropdownlists,radiobutton and checkbox asp standard controls. On the click event of the command button the data gets stored into the database. I have created the stored procedures for the insert,update,delete. I have...
2
10458
by: =?Utf-8?B?Q2FybG8gTWFyY2hlc29uaQ==?= | last post by:
I am building a GridView dynamically adding templatFields according to a Microsoft article. I had to create a class with the ITemplate interface and a method called InstantiateIn. Everything works fine except that I am unable to sort such a templatefield. AllowSorting is true: <asp:GridView ID="gvwPend" runat="server" AllowSorting="True" AutoGenerateColumns="False" ... OnSorting="gvwPend_Sorting">
5
6519
by: Tim Mackey | last post by:
hi, with a derived DataGrid control, i can override the CreateColumnSet method and scan into the DataGridColumns and set the DataFormatString, e.g. leave out the time part of a DateTime value. this works great for a DataGrid control. however i'm upgrading this control to inherit from GridView. there seems to be a limitation of the gridview "Method not supported" when you try and set a DataFormatString on an AutoGeneratedField.
3
2041
by: kimbred | last post by:
Can someone help? I have the code below in which I'm attempting to show or hide the edit control in a gridview based on the value of a column in that view. It doesn't seem to find the control. I've included the RowDataBound event as well as the gridview definition. Thanks in advance. protected void gvEmployeesBenefits_RowDataBound(object sender, GridViewRowEventArgs e) { TextBox EditFlg = (TextBox)...
1
2424
by: abhi83 | last post by:
Hi , I have a problem hope someone can help. I have created a dynamic view which contains a gridview. This gridview contains a check box column in the Template Field with the help of ITemplate interface. Now the prblm is I'm not able to access this check box . I am using CheckBox chkSel = (CheckBox)gvRows.Cells.FindControl("ckh"); to find the check box but 'chkSel' is always returning null.This check box is in every row of the...
0
8792
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
9479
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
9209
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...
0
8215
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6754
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
6054
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4826
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3280
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
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.