473,396 Members | 1,921 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,396 software developers and data experts.

how to find a label control within nested datalist on selectedIndexChanged?

40
how to find a label control within nested datalist on selectedIndexChanged?
Expand|Select|Wrap|Line Numbers
  1.  protected void SelectedIndexChanged(object sender, EventArgs e)
  2.     {
  3.  
  4.         dlEvntImages.Visible = true;
  5.         BLL_NewsAndEvents objNE = new BLL_NewsAndEvents();
  6.         objNE.title = dlEvents.DataKeys[dlEvents.SelectedIndex].ToString();
  7.         objNE.getImageDetails();
  8.         if (objNE.tests)
  9.         {
  10.             DataList dllEvntImages = (DataList)FindControl("dlEvntImages");
  11.  
  12.  
  13.  
  14.  
  15.             //Label lblMsg1 = (Label)FindControl("lblMsg");
  16.             Label lblMsg1 = (Label)dllEvntImages.FindControl("lblMsg");
  17.                 //(dlEvntImages.SelectedItem.FindControl("lblMsg"));
  18.             Label lblId1 = (Label)dllEvntImages.FindControl("lblId");
  19.             Label lblKey1 = (Label)dllEvntImages.FindControl("lblKey");
  20.             Image evntImage1 = (Image)dllEvntImages.FindControl("evntImage");
  21.             //lblMsg1.Visible = true;
  22.             lblId1.Text = objNE.Id.ToString();
  23.             lblKey1.Text = objNE.Key.ToString();
  24.             lblMsg1.Text = objNE.imgDesc.ToString();
  25.             evntImage1.ImageUrl = "~/ASHX/viewEvntImageHandler.ashx?Id=" + lblId1.Text + "&Key=" + lblKey1.Text;
  26.             objNE.Close();
  27.  
  28.  
  29.         }
  30.  
  31.     }
  32.  
May 22 '10 #1
1 2614
Frinavale
9,735 Expert Mod 8TB
What's the problem?
The above code should work in theory.
May 31 '10 #2

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

Similar topics

1
by: Paul Maidment | last post by:
Hi, I am a bit green when it comes to .net development so please excuse me if this question is obvious or has been asked before... I am trying to programmatically access a label control...
1
by: Doug | last post by:
The html below shows DataList "DiscountList" nested within DataList "EventItemList". DiscountList contains a Label control. I'm trying to find the label, using FindControl, during...
1
by: DC Gringo | last post by:
I am a bit twisted and need some straightening out. I have a webform with 3 controls on it: a mainHeader, a sectionHeader with a label control contained in the mainHeader, and a topHeadline. In...
2
by: Olav Tollefsen | last post by:
I have a Web Form with a DataList. Inside the ItemTemplate, I have a DropDownList control. <asp:DataList ID="ProductDataList" Runat="server"> <ItemTemplate> <asp:DropDownList ID="DropDownList1"...
3
by: Derek | last post by:
I have a nested datalist with a dropdownlist. I need to capture the selectedvalue of the dropdownlist so I can update a database table. My question then is...how do I get the value from the...
1
by: | last post by:
I have a label control that I've embedded in a datalist template. I will be binding data to that label. I want to run a string formatting function on the database text before it is injected into...
1
by: needin4mation | last post by:
I have this code: protected void DataList1_ItemCreated(object sender, DataListItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) {...
2
by: mpl | last post by:
Hi, i have an ascx file named mytestcontrol.ascx. it has reference to another ascx control as below. <%@ Register Src="myControl.ascx" TagName="myControl" TagPrefix="uc" %> .... .........
0
by: Brian Lowe | last post by:
I'm in a web page and I have hierarchical data so I'm using 2 nested DataList controls. DataList1 is using a data source with rows of , , and where MoreData is a list. DataList1 has an...
6
by: Ria12 | last post by:
Hello,kindly request you to plz help me..... I have label control in the datalist.I want to display the text in this label with line breaks....Plz help me......Thks in advance.
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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
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.