.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Datalist control

Posted By:      Posted Date: October 25, 2010    Points: 0   Category :ASP.Net


I am new in asp.net and i want to use DATALIST CONTROL.Plz tell me how to use that controlstep by step process..

View Complete Post

More Related Resource Links

Add control in Datalist at run time

Hi I want to know that how i can add the Linkbutton in Datalist in ItemTemplate at run time in the DataBound Event.Thanks

Datalist and Ajax control toolkit Modal Popup window

Hi friends I have created list of thumbnail images in datalist and on clicking image i want to pass image name to Ajax control toolkit Modal Popup window which display bigger image.   Please help me.

how to find control from header template of a datalist?

 Hi,I have a textbox in header template of a datalist. From code behind i've to access these textbox from page_load event.I tried with the following code. DataList.Controls[0].FindControl("myControl") But it have error. how to solve it? 

How can I get Result Search with Paging in DataList Control

 I have Database called mygroup , and I have three tables *  Cataloges table .. columns (CatalogeId  int,   CatalogeName nvarchar) *  Brand table  .. columns (BrandId  int,   BrandName nvarchar) *  Products table, it is consists of these columns : ProductId   int ProductNO  nvarchar CatalogeId  int BrandId   int MainSpecification  nvarchar DetailsSpecification  ntext Image  imageand I want to desgin form for products, and this form contain these ToolBox *   DropDownList  for CatalogeId *   DropDownList for BrandId *   DataList Control for displaying the Result Search *  Button   When the user visit Product Page for Example (productpage.aspx),  then he see the two DropDownList , then choose one of Cataloge Name (Laptop , Printer, ....) , and choose one of the Brand Name (Sony, Toshiba, ....) , then Click the Button, and get the  Result Search in Paging DataList 

find control inside datalist


I want to find control inside datalist, i am using this:


//here got error: Index was out of range. Must be non-negative and less than the size of the collection.

here is my aspx code:

<asp:DataList ID="DataList1" runat="server" DataKeyField="nsid">
     <asp:Label ID="Label1" Text='<%# Eval("ncompany") %>' Runat="Server" CssClass="subject&quo

find control in datalist by javascript(Not by Code Behind CS Page or ItemDatabound)


Hello all,

I am facing a problem with javascript.Following is the scenario:

I am working on survey application......

I have taken a datalist in which the question in survey are bound in a label control

now user can change color of the question using color picker

color picker have a popup which is closed when user selects a color and

the color of question will be updated as popup closes

So i have to find label control(in which i bound questions)

in datalist by javascript only (not by Cs page or by itemdatabound event because of color picker popup i can not use cs page)

and update the color of label selected by color picker

I googled and found following code but it show null value

var lbl = document.getElementById('<%= Page.Master.FindControl("ContentPlaceHolder1").FindControl("dList").FindControl("lblQuestion") %>');

when I saw the page source following id is generated for label

and so on


Referring Control inside datalist from javascript


Hi All,

Problem i am facing in referring textbox control in javascript which is inside Datalist control . i havent found any right solution for the problem if anyone can contribute then i will be very thankfull.

<cc1:lecklabel id="lblnpc" runat="server" token="0" Width="942px" BackColor="SteelBlue" Font-Bold="True" ForeColor="White">Non Production Cost System</cc1<

Control the length of string in label which is in datalist


I have a label control in datalist. When thw word is long, the text of label corrupts the design. Label hasn't a multiline property.

I tried different ways . I tried to use textbox like a label but this time I can't give a link to textbox.I tried to use MeasureString() method for the label. But I couldn't do it.

Please help me... Thanks....

validation control in datalist error


hi guys,

i'm having some problem with my validation control that i put inside my datalist template. the purpose of the validation is to ensure that user enter only integer at the textbox inside the datalist. however, if there is more that 1 record/row at the datalist and i enter the integer only in one of the textbox at a specific row, the validation control ask me to enter a value for the other datalist record when i press the button. so my question is, is there a way to make sure that the validation control only check the specific textbox at the specific row?? i tried editing the properties of the validation control but i cannot find anything that is relevant...

Your help is greatly appreciated!!

Thank you in advance


adding static text before Bind() in datalist control


Hello, I have a datalist control

In it, I have a hyperlink that im binding the url, and the text to from a mysql database

here is my code so far

<asp:HyperLink ID="HyperLink1" runat="server"
    NavigateUrl='<%#Bind("topicid") %>' Text='<%# Bind("title") %>'></asp:HyperLink>

Now, the problem is, the field "topicid" returns a number, such as 3. I want to add the following text before it: viewTopic.aspx?id=

So, ideally, i want something like this

<asp:HyperLink ID="HyperLink1" runat="server"
    NavigateUrl='<%# "viewTopic.aspx?id=" + Bind("topicid") %>' Text='<%# Bind("title") %>'></asp:HyperLink>

But, when I do it that way, I obviously get an error.

So, is there any way to solve this problem without having to modify the database?

Thank You

How can I use my existing datalist control as template to call it several time?


Hi. I have created a DataList like below. I want to use it as template or call it's ItemTemplate in new created DataList control. Does anyone has any idea? Please HELP CryCryCry. THANKS!!

<asp:DataList ID="MyDataList" runat="server" CellPadding="4" CssClass="dlist"  ForeColor="#333333">                                               
    <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
    <AlternatingItemStyle BackColor="#9999FF" ForeColor="#0000CC" />
    <ItemStyle BackColor="Lavender" BorderColor="#00CCFF" BorderStyle="So

How to get some data fom GridView (or whatever control DataList etc...)


Hi everyone,

I really love GridView and I like to use it whenever it suits well. Just out of curisority, recently, I been thinking what if i wanna get sme data from the GridView I just bind on the page without actually nesting each column and row? For example :


From the above table, say I wanna take the value Three and Five. How can I get it back from the table ? I know I can query back the database to get the value but that's not what I am trying to figure out here. Thanks all and will be looking forward to getting some cool stuff from you guys.

Adding Dynamic Rows in ASP.NET GridView Control with TextBoxes and with Delete functionality

In my previous examples, I have demonstrated on how to add dynamic rows in GridView control with TextBoxes and how to save the values into the database. Now, seems that most of the developers are asking if how to add a delete functionality with it. So in this example, I'm going to show on how to delete a certain row in the dynamic GridView with TextBoxes.

Accessing the different controls inside a GridView control

how we can access a particular control which resides inside a GridView control. In this article I will show you how you can access different controls inside a GridView control. We will see how we can access a TextBox control, a DropDownList control and a ListBox control. If you are working with ASP.NET 1.X then you might want to check out my article Accessing Different Controls Inside a DataGrid.

In-Depth look at the GridView Control

In the last article we looked at few of the new controls available in Asp.net 2.0. We also talked about Grid View Control which has replaced the Asp.net 1.1 DataGrid control for good. In this article we will examine more features of the Grid View control. In this article we will see some of the common operations that can be performed using the GridView control. Apart from these operations there are many more functions that can be performed on the control and which we will see in the later articles

ASP.NET repeater control - databind with style

even used the inline editing features, which I at the time thought was the coolest way possible to write ASP.NET code ( I managed to write code to hide all other rows and only show the current one - the row being edited). With a nice looking EditTemplate it looked indeed very slick but it really turned into giant and hard to manage code behind files.

Creating Paging for a Repeater Control

A common question is "How do I implement paging within a Repeater?" Although the beauty of the Repeater control is its flexibility, you're on your own for building most functions. ASP.NET 2.0 has included some new controls that provide paging, as does the DataGrid in ASP.NET 1.1. However, this tip shows you how to roll your own paging for a simple data viewer.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend