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

Post New Web Links

Changing data item value Repeater dynamically

Posted By:      Posted Date: November 01, 2010    Points: 0   Category :ASP.Net

How do i dynamically change the value of dataitem in repeater control(.net 2.0,VS 2005)..i have repeater something like this :
<asp:Repeater ID="rptGameInfo" runat=server OnItemDataBound="itemDataBound_rptGameInfo"  >
<HeaderTemplate >

<ItemTemplate >
<asp:Label ID="lblLoc" runat=server Text="Location:" ></asp:Label><%# Eval("GAME_LOCATION")%><br />
</ItemTemplate >

and it shows the result like this:

If location is "Select" i want to change it to "n/a". So i am trying to capture it in itemDataBound even something like this

if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
                DataRowView row = e.Item.DataItem as DataRowView;
                string location = row["GAME_LOCATION"].ToString();

                if (location == "Select"

View Complete Post

More Related Resource Links

Dynamically (on client side) populating data control (repeater) when dropdown item is selected

Hello!I'm currently working on a project and I want to make as much things as possible performing on client side - with as little loading as possible.The project consist of three "main" pages. On one page I use jQuery DataTable plugin which is working great. One page has tabs (using jQuery). I want to put datacontrol (repeater) on this site and when  user selects one item in dropdown, data in repeater loads on client side, without performing the action on server.I wonder if this is possible and if somebody can give me some case to help with?Thanks!I hope I was clear enough. all the best

I need to be able to disable a button inside a repeater control when an item in the data is <1

For example, I have an inventory table. If any one of the items is less then one, I need to disable the button. <asp:Repeater id="repeater1" <ItemTemplate> <asp:Button id=btnSize /> </ItemTemplate> </asp:Repeater>  

Displaying Data using ASP.NET 2.0 Repeater and C#

This tutorial will show you how to display data using the .NET Repeater Control, ASP.NET 2.0 and C#.NET

The Repeater control is a powerful tool and is easy to use.

First, you will need to import the System.Data.SqlClient namespace.

Persist data in a dynamically populated ListBox in a user control


Hi All,

I am trying to persist data in a dynamically populated ListBox in a user control. Here are the details

I have a user control which contains a a listBox and button. On Page_Load of user control I am populating the ListBox control with some values. On Click of button, I am trying to fetch the values which I have selected in ListBox. Though this seems very simple and straight forward I am unable to fetch values.

My Page_Load Function

void Page_Load(object sender, EventArgs e)










My Click Function

Protected Void Button1_Click(object sender, EventArgs e)


       string strValue = listBox.SelectedValue



I have placed brake point at Page_Load and on click function, I am seeing that the moment the breakpoin

Cutting Edge: Data Repeater Controls in ASP.NET


The ASP. NET Repeater is a basic container control that allows you to create custom lists from any data available to the page. It's a handy control, especially since most ASP. NET pages that display data need to repeat the same kinds of data over and over.

Dino Esposito

MSDN Magazine June 2005

.NET Reflection: Dynamically Bind Your Data Layer to Stored Procedures and SQL Commands Using .NET M


One major inconvenience of using SQL stored procedures from code is having to match type information. You have to write long wrapper functions around the procedures just to expose the data types. In the .NET Framework, however, the reflection services of the System.Reflection namespace allow you to query rich metadata that describe data types. This article explains how to use reflection in .NET to end your stored procedure nightmares. The author creates four custom classes, including one that generates a SQLCommand object based on the metadata of a method. Using this library, you'll be on your way to automating the generation of stored procedures.

Atif Aziz

MSDN Magazine August 2002

problem...i want a list item to populate all data in gridview!!!


i have a dropdownbox and a gridview

what I want is to have a list item which populates all data in a gridview.

I have tried using list item selected value=0 but to no avail.

what is the easiest way to achieve this?

Dynamically Populate a DVWP depending on selected item



I am wanting to create a dashboard page with several data view web parts which dynamically populate depending on what item is selected in a separate web part (drop down form or just a list of links).  Can someone please point me to a tutorial or documentation on how to pass data between web parts or to a DVWP?  I have searched for a few hours and not been able to find anything useful.



Changing aspx page causes session data to be lost...


Strange but true. Any ideas what might be causing this?


Parameter Data changing between DataSource_Inserting and the BLL call



I have a problem when trying to validate data on insertion (and possibly update, didnt try it yet) .

I use a formview in insert mode, linking to a custom BLL that then link to a DAL to insert data into a table. The problem is the parameter data is changing between the Datasource inserting event and when the BLL insert method is called. 2 field, that cannot be null in the database, have default value added to them. Bot sure how to explain so well so 'ill post some picture explaining :

This is the form I use, I enter only test in the textbox for the value Nom

this is the trace for my DataSource_Inserting event, as you can see, only the "Nom" value is non-null

But then, right after the event is done and the call is made to the BLL, the value for "Sexe" and "DateDeNaissance" has been changed to some default value, namely 0 and Jan 1, year 1.

This of course is causing problem because if the user does not provide value for "Sexe" and "DateDeNaissance" then I want t

How can i add a textbox into a GridView Cell dynamically and how can i retrieve entred data

Hey, i think that the the subject can explain what i need, it's about adding a TextBox control with the code behind into a GridView, and also about how can i retrieve entered data after submitting, im using C#,Thanks.

How to fetch data from textbox dynamically in a gridview

How to fetch data from textbox inside a gridview

Invalid data has been used to update the list Item.(List definition)

<nativehr>0x80070057</nativehr><nativestack></nativestack>Invalid data has been used to update the list item. The field you are trying to update may be read only. I have created a list definition and into that i have created lookup column when i am trying to add any item into the list then it gives me an error as above. Can anyone help me.? I made the readonly attributes to false for lookup columns.  

Unable to Show Edit item Links in Data Form Web Part

I have a DFWP connected to custom list and the boxes to Show Edit Item Links, Show Delete item links and Show Insert Item links are grayed out so that they can not be checked. This works fine when I use a DFWP connected to a standard list (i.e., Contacts). Is there something special that needs to be done to activate this functionality?ThanksDean

changing font color on a data column field based on the contents

I am trying to change font color if the datafield has the string EMERGENCY. This is my original template field: <asp:TemplateField HeaderText="Type" SortExpression="DigType"> <EditItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Eval("DigType") %>' ></asp:Label> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Eval("DigType") %>' ></asp:Label> </ItemTemplate> </asp:TemplateField>   and this is what I thought would work: <EditItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Eval("DigType") %>' ForeColor='<%# IIf(Eval("DigType")="EMERGENCY","Black", "Red") %>'></asp:Label> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Eval("DigType") %>' ForeColor='<%# IIf(Eval(&quo

Database vs XML for complex changing data

Hello, I'm researching and experimenting with aspects of a new project before final design.  It will be in two parts: 1. a designer interface (like visio)2. client to display the content created within the designer interface. We have the design outline in place, the client will be in many forms, via the web using Flash or Silverlight (depending what's installed) and via windows using a WPF application. I would like to know what people think regarding storing information from the designer, all the clients will need to access the information via the internet so a database storage solution seems the first choice. But another alternative is exporting the information from the designer in something such as XML and storing that as a physical file. The designer will be an application allowing the users to create multiple pages (like PowerPoint slides), each of which they have control over placement objects (images, text, buttons etc). A database approach will require a lot of work when changes are made with update, delete and inserts every time a page (slide) is changed. The XML approach seems easier to manage because each time the page (slide) is amended the XML file can either be delete and recreated or the content inside replaced with the new designer layout. It would be great to hear what other people think. I was thinking for XML to separate each slide into a separate

Dynamically add item to DropDownList??

I have an Edit page in my application that contains a DropDownList. This DDL is bound to an EntityDataSource that only shows the active "ProjectManagers". In the case where the user is editing a record that is assigned to an "inactive" ProjectManger, an "ArgumentOutOfRange" Exception is (rightfully) thrown by the DDL (because that Item wan't bound to the list, since it only binds "Active" ProjectManagers). So, I need to add this item to the DropDownList dynamically or at least add an "Inactive" item and then "select" that item in the code behind. (Although, adding an "Inactive" item would force the user to actually change the ProjectManager and that wouldn't be a good idea.) I have tried handling the OnDataBinding method with the following code:   protected void PreventErrorOnBinding(object sender, EventArgs e)    {        DropDownList theDropDownList = (DropDownList)sender;        theDropDownList.DataBinding -= new EventHandler(PreventErrorOnbinding);        theDropDownList.AppendDataBoundItems = true;        ListItem li = new ListItem(""<<Inactive>>", "0");     
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