datalist

Set a datalist.datasource from inside a usercontrol - asp.net c#

I have a usercontrol that contains a datalist, and I want to set the datasource of the datalist to different things depending on what page the usercontrol is on. So, I think what I need to do is expose a public property of the datalist that will get the datasource and set it, like so: public datasource UserDataSource { get { return Da...

How to access the databound selected item in a datalist after postback?

How do you access the databound item after postback? I have a datalist,and when the user selects an item, the OnItemCommand event fires, and my event handler looks liek this: protected void dlResults_Select(object sender, DataListCommandEventArgs e) { MyItem item = e.Item.DataItem as MyItem; } item is always null. Is there a way t...

ASP.NET C# - Removing a column from a datalist

I have a datalist inside a usercontrol that gets loaded into a page where users can customize a report based on some checkboxes. One of the checkboxes, however, is "Hide Worklog" which should hide the worklog column from the result set because it can be quite long and interfere with the report. If I do: datatable1.Columns.Remove("W...

At which point and how do rebind datalist inside usercontrol on button click?

I have a usercontrol (Imageselector.ascx) that consists of a datalist. The datalist's itemtemplate contains another usercontrol (selectoricon.ascx) that contains an imagebutton. In default.aspx page i include the Imageselector.ascx and populate its datalist from db with DataBind(). In the datalist's onItemdataBound event I populate the s...

ASP.NET datalist question

I have made some progress with the DataList and UserControl this morning but I still try to figure out how I could improve my code (everything work but the GUI is not yet what desired). In the ASPX file I have something like that : <asp:DataList ID="dlSpeechBubble" runat="server"> <ItemTemplate> <CSVSMS:Bubble I...

Eval ID on radiobutton in Datalist

my code gota datalist with radio button and iv made it single selectable onitemdatabound....now im trying to evaluate a hiddenfield on basis of selected radio button my code goes like this aspx code <asp:DataList ID="DataList1" runat="server" RepeatColumns = "4" CssClass="datalist1" RepeatLayout = "Table" OnItemData...

request sql data without postback

i have a datalist with radio button..i can read id of selected item thru radio button in hiddenfield..is there a way to do it without postback or asyncpostback ???? <asp:UpdatePanel ID="UpdatePanel9" runat="server" > <ContentTemplate> <asp:DataList ID="DataList1" runat="server" RepeatColumns = "7" ...

paging in datalist using javascript

iam trying to use paging for my datalist using following code...iam able to do it server side but how can i do it client side..i mean iam already binding my datalist on page load..alli need is to allow paging on client side aspx <asp:LinkButton ID="LinkButton3" runat="server" CommandName="Previous" Text="<< Previous" ...

Row separator in datalist

I'm using a datalist control. How I can add a row separator in the datalist? I have more than one item in a row and I'm using .Net 2.0. Separator template work for each item not for each row. I want to display it like this. row1-> item1 item2 ---separator row2-> item3 item4 ---separator row3-> item5 item6 ...

Issues with Checkbox list losing Attrubutes on a postback

I have a Datalist which renders a list of checkboxes and value attributes on each of them, when another control fires a postback the value attribute is lost on each of the checkboxes HELP!!!! ...

Adding javacript in Datalist

That's my code but that says not well formed.... How can i correct that? <ItemTemplate> <asp:HyperLink ID="HyperLink1" runat="server" Text='<%# Eval("Name") %>' onClick="<%#"javascript:popUp(\'gallery_detail.aspx?cat_id=\""+ Eval("ID") +"\"\')"%>"></asp:HyperLink> <br /> <br /> </ItemTemplate> ...

Repeating the Header of a DataList

I'm using an asp:DataList. I have the HeaderTemplate and the ItemTemplate, and those both work fine. However, I'd like to be able to repeat the Header above each Item, rather than just once at the top. Is this possible? Would I be better off using a different control? Can I make this configurable (ie, can it be turned on & off in th...

Retrieve data from DataList

It would be a simple table on the page, which has some initial cells and another user should enter. I use DataList with ItemTemplate: <ItemTemplate> <asp:TextBox ID="CellTextBox" runat="server" Text='<%# Bind("Cell") %>' /> </ItemTemplate> In code i override DataBind() of this control: public override void DataBind() { ...

DataList control

I've migrated VS 2005 Web Site Project to VS 2005 Web Application Project. And find out that html which generated by my DataList control was changed. There is ItemTemplate: <ItemTemplate> <asp:Label ID="CellLabel" runat="server" Text='<%# Eval("Cell") %>' Visible='<%# Eval("Cell").ToString() != "0" %>' /> <asp:TextBox ID="CellTe...

List as DataSource for DataList

All Types implement IEnumerable interface could be used for a DataSource of a DataList. For example List. But what we will write for the data bound expression in ItemTemplate? List<int> myList = new List<int>(); for(int i=0; i<10; i++) myList.Add(i); myDataList.DataSource = myList; ... <ItemTemplate> <asp:TextBox ID="myTextBox" run...

Styles in dataList control

In the ItemDataBound handle i set backgroud color to some items: protected void MyDataList_ItemDataBound(object sender, DataListItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { TextBox cellTextBox = (TextBox)e.Item.FindContro...

Sort Datalist in ascending order

How to sort a datalist in aspnet? The datalist should be listed in ascending order. How to do this simply? How to assign the column to be sorted? Plz, help me! ...

Adding Checkbox during Databind

Hello, I have a Datalist and I am trying to insert a checkbox for each record that gets bound to the datalist. The first record has the checkbox but the subsequent records do not. I suspect that what I am doing is just replacing the first checkbox eachtime a record is bound. Can someone give me some insight? I need the checkbox to be re...

How do I get reference to a control on a Datalist's OnItemBound?

Hey everyone, I need to set custom attributes on a control as it is bound to a datalist. I see that the event arguments has a collection of controls but I do not see any reference name associated with them. How can this be done? When I try this: (e.Item.FindControl("autoChartChkBox") as CheckBox).Attributes.Add("CompanyToken", "Compan...

datalist problem

I have a datalist binded through sql datasource which displays image and its name, now I want to edit each item and want to add some description with it. Is it possible to do it in the aspx pag itself I mean I don't want to bind the description through datasource. Below is the code <asp:SqlDataSource ID="SqlDataSource1" runat="server" ...