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

inserting control in ItemDataBound

Hi-

I am developing a hierarchical navigation system. I have a DataList with
the root level items, on the ItemDataBound event, I check for the selected
item, when found I'm adding an additional DataList Control to display the
sub items. Pretty standard.

I now realize that I don't know how to format this newly added Datalist. I
am binding a complex type to it, so I need to have DataBinder.Eval() calls,
etc... but HOW can I do that? The control doesn't exist in any aspx page,
so I don't have access to the html.

Does this make sense? I hope so. If you have any suggestions, please let
me know.

Thanks,
Steve
Nov 17 '05 #1
2 1363
you need to create a function and add that function to
your newly created datalist's itemdatabound event. You
could do your formatting within that function.

example:
//your function
newItemDataBound(object sender,
System.Web.UI.WebControls.DataListItemEventArgs e)
{
//do your formatting here
}

//add this to your newly created datalist
newDataList.ItemDataBound += new
System.Web.UI.WebControls.DataListItemEventHandler
(newItemDataBound);

Hope this helps...
-----Original Message-----
Hi-

I am developing a hierarchical navigation system. I have a DataList withthe root level items, on the ItemDataBound event, I check for the selecteditem, when found I'm adding an additional DataList Control to display thesub items. Pretty standard.

I now realize that I don't know how to format this newly added Datalist. Iam binding a complex type to it, so I need to have DataBinder.Eval() calls,etc... but HOW can I do that? The control doesn't exist in any aspx page,so I don't have access to the html.

Does this make sense? I hope so. If you have any suggestions, please letme know.

Thanks,
Steve
.

Nov 17 '05 #2
Yes, this did help. Thank a lot!!

"Edward" <an*******@discussions.microsoft.com> wrote in message
news:0b****************************@phx.gbl...
you need to create a function and add that function to
your newly created datalist's itemdatabound event. You
could do your formatting within that function.

example:
//your function
newItemDataBound(object sender,
System.Web.UI.WebControls.DataListItemEventArgs e)
{
//do your formatting here
}

//add this to your newly created datalist
newDataList.ItemDataBound += new
System.Web.UI.WebControls.DataListItemEventHandler
(newItemDataBound);

Hope this helps...
-----Original Message-----
Hi-

I am developing a hierarchical navigation system. I have

a DataList with
the root level items, on the ItemDataBound event, I check

for the selected
item, when found I'm adding an additional DataList

Control to display the
sub items. Pretty standard.

I now realize that I don't know how to format this newly

added Datalist. I
am binding a complex type to it, so I need to have

DataBinder.Eval() calls,
etc... but HOW can I do that? The control doesn't exist

in any aspx page,
so I don't have access to the html.

Does this make sense? I hope so. If you have any

suggestions, please let
me know.

Thanks,
Steve
.

Nov 17 '05 #3

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

Similar topics

3
by: anon | last post by:
I am having a hard time with makeing what I am trying to do work. I am making a questionaire web app. I have a custom control that has a label and 5 radio buttons. My problem is that each...
3
by: neverstill | last post by:
Hi- I have an asp:image control in the ItemTemplate of a DataList currently, in the ItemDataBound event, I am getting a reference to the image control by looping through all the controls in the...
2
by: John Holmes | last post by:
I am using radioButton controls in a data repeater and would like to incorporate the 'key' field into the 'id' attribute of the radioButton controls and name them something like: 'rad' + '<%#...
5
by: Paul | last post by:
Hi I need to change the text value of a dropdown list box that is in a template column of a data grid but was not sure how to access it, probably something like datagrid1.control.dropdownlist.text...
8
by: Nevyn Twyll | last post by:
I have a multi-level datalist setup: DataList1 DataList2 MyGrid I have columns explicitly defined for the grid in the html. Sometimes, On the initial Load() of the Page, I want to add extra...
3
by: WebMatrix | last post by:
I am struggling with implementing somewhat complicated UI web-control. I explored Repeater, but I am not sure if it's the best way to go. I am leaning towards writing my own custom control and...
7
by: | last post by:
I have what's probably a simple page lifecycle question related to dynamically evaluating values that are placed by a repeater and dynmically placing user controls that use those values. I'm...
1
by: Dave A | last post by:
I have a problem that I have boiled down to a very simple example. I have a user control that displays a some data from a business object. On one screen I have a collection of these business...
0
by: KBTibbs | last post by:
I've got a Menu control that will be used for navigation around my site. I would like to have my menu be a series of images with mouseover image swapping. I found a blog entry that seems promising...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
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
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,...
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
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...

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.