473,406 Members | 2,894 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,406 software developers and data experts.

Controls not recognized in the code behind file.

Hi, I am having a problem thats really driving me nuts, i have a datagrid
and one of the labels is initialised with a database value
using the <%#Container.DataItem("something") %>

now when i do this, the code behind file is not recognizing the label
control. Any work arounds for this?

thanks in advance

-K
Nov 18 '05 #1
1 2991
You didn't show your server-side code, but the asp.net code should look
something like this:

<asp:TemplateColumn HeaderText="Label">
<ItemTemplate>
<asp:Label id="Label1" runat="server"
Text='<%#Container.DataItem("FirstName")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateColumn>

Private Sub DataGrid1_ItemDataBound _
(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) _
Handles DataGrid1.ItemDataBound
Dim lbl As Label
lbl = e.Item.FindControl("Label1")
If Not IsNothing(lbl) Then
lbl.Text = "Hello..." & lbl.Text
End If
End Sub
"SWATHI ALLU" <sw*********@verizon.net> wrote in message
news:eJ***************@TK2MSFTNGP09.phx.gbl...
Hi, I am having a problem thats really driving me nuts, i have a datagrid
and one of the labels is initialised with a database value
using the <%#Container.DataItem("something") %>

now when i do this, the code behind file is not recognizing the label
control. Any work arounds for this?

thanks in advance

-K


Nov 18 '05 #2

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

Similar topics

1
by: | last post by:
Hi Guys, I am generating dynamic server controls using XML and XSLT. With this I am generating two buttons which when clicked redirect the page to a different page. Here is my "checkout"...
2
by: Jerry Camel | last post by:
Has anyone had this issue... I working on a simple ASP .NET app - three web forms. I'm working on page three and when I swith back to page 1 in VS, half of my controls are missing. I add them...
2
by: Brandon Potter | last post by:
Why is it that when I override the OnInit method for a page, I can add a user control like this: Me.Controls.Add(LoadControl("MyControl.ascx")) (where MyControl.ascx is your every day user...
2
by: Ric | last post by:
im new to asp.net. from what i understand, you have the aspx file (presentation), user-control(ascx file), code-behind(vb file) and components(compiled vb and dll files). the aspx file contains a...
5
by: siaj | last post by:
Hello All, Can any one give me a clue when to use Web Server controls/ HTML server controls/HTML Controls. As I understand .. HTML controls should be used if u dont need to refer it in the code...
7
by: Alan Silver | last post by:
Hello, I am just looking at VWD and seeing what needs doing to take an existing site I've written by hand and importing it into VWD. I've already discovered that I need to rename my code-behind...
9
by: Alan Silver | last post by:
Hello, I have a user control which I am trying to load dynamically, but am running into problems. I think the problem is because I have two .ascx files that refer to the same .ascx.cs file. A...
0
by: mivhaelveloz | last post by:
Hiya Im trying to get a user control working in mono/ASP.NET. ....I have no problem getting a basic control up and working and using it declaratively in a hosting page's .aspx file. But for...
2
by: ruthiefy | last post by:
Hi, I need a few sql queries results so I created a new class with has a few functions that load the data. After executing ExecuteReader, I need to load the data to the dropdownlist control....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
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...
0
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...
0
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,...
0
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...

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.