473,563 Members | 2,709 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Binding data to a server control inside repeator control

Hi guys,

Iam using a repeator control in my page.In wich i have
dropdown list as the last column.I have a label in the first
column.Now i have binded a datable to the repeator in the page load
event.And assigned vale to the label in html as

<asp:Label ID="c_invAmt" Runat="server" cssclass="smcsA mountLabel">
<%# DataBinder.Eval (Container.Data Item,"InvoiceAm ount") %>
</asp:Label>
Now i want to bind data to the dropdown list in the last column.I have
a function that returns a datatable.

I tried to bind the dropdown in html as follows

<asp:DropDownLi st ID="c_currencyL ist" Runat="server" Visible="False"
DataSource='<%= GetCurrencies() %>' DataTextField=" XXX"
DataValueField= "XXX">
</asp:DropDownLis t>

But it throws an error saying

The datasource property is set only by the run time.It cannot be
declared.

So i tried to bind the dropdown list in the itemdatabound event of the
repeator.But the data is not binded to the dropdown list.

How can i achieve that.Can any one help me out...........

Apr 6 '06 #1
3 1720
So bind it at runtime

"muthu" wrote:
Hi guys,

Iam using a repeator control in my page.In wich i have
dropdown list as the last column.I have a label in the first
column.Now i have binded a datable to the repeator in the page load
event.And assigned vale to the label in html as

<asp:Label ID="c_invAmt" Runat="server" cssclass="smcsA mountLabel">
<%# DataBinder.Eval (Container.Data Item,"InvoiceAm ount") %>
</asp:Label>
Now i want to bind data to the dropdown list in the last column.I have
a function that returns a datatable.

I tried to bind the dropdown in html as follows

<asp:DropDownLi st ID="c_currencyL ist" Runat="server" Visible="False"
DataSource='<%= GetCurrencies() %>' DataTextField=" XXX"
DataValueField= "XXX">
</asp:DropDownLis t>

But it throws an error saying

The datasource property is set only by the run time.It cannot be
declared.

So i tried to bind the dropdown list in the itemdatabound event of the
repeator.But the data is not binded to the dropdown list.

How can i achieve that.Can any one help me out...........

Apr 6 '06 #2
What do you mean to say.....

Apr 6 '06 #3
The error says you can't bind the data like you are doing, i.e.
declaratively, you can only do it at runtime. So do it at runtime instead.

E.G. Don't do this:

DataSource='<%= GetCurrencies() %>'

Put something like this in you pageload event

if (!IsPostBack)
{
c_currencyList. DataSource = SomeDataSourceO bject;
c_currencyList. DataBind();
}

"muthu" wrote:
What do you mean to say.....

Apr 6 '06 #4

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

Similar topics

0
2331
by: Ann Morris | last post by:
INTRODUCTION One of the most powerful aspects of .NET and Windows Forms is data binding. Data binding is the process of associating user interface (UI) elements with a data source to generate a visual representation of data. Two types of data binding are available for Windows Forms: Simple Data Binding and Complex Data Binding. Simple...
2
1443
by: Steve Lloyd | last post by:
Hi there, I have a set of products each of which has attributes (color size etc), is it possible to use a data list or repeator to display all the items and provide combo box with a unique set of attributes in each list/repeator item as a sort of sub query. Thanks for any help, Steve
1
2711
by: Dot net work | last post by:
Hello. I have an interesting data binding scenario: I have a repeater control. It repeats a typical custom web user control. I also have a collection object, and each collection element contains various pieces of information inside a custom object, including an id field.
3
2046
by: bbernieb | last post by:
Hi, All, Is it possible to access a variable inside of a data binding, without the variable being out of scope? (Note: On the DataBinder line, I get an error message that says "Name 'i' is not declared". The data bind is for a DataList.)
9
5320
by: Timm | last post by:
I have an ASP.NET 2.0 page with two DropDownLists. I am using declarative data binding wherever possible and trying to minimize the use of code. The list of values in DropDownList DDL2 should be (filtered) dependent upon the selection in DDL1. I think this inevitably needs some code, but I'd be happy to be told otherwise! I have some code to...
1
1068
by: muthu | last post by:
Hi freinds, Iam using repeator control in my application.The code behind is vb.net. I have n number of rows and 5 columns in the repeator control.In the ItemDataBound event of the repeator control i have a variable which should get the value of first column in the repeator column.How can i achieve that... Pls help me out .......
0
343
by: muthu | last post by:
Hi guys, Iam using a repeator control in my page.In wich i have dropdown list as the last column.I have a label in the first column.Now i have binded a datable to the repeator in the page load event.And assigned vale to the label in html as <asp:Label ID="c_invAmt" Runat="server" cssclass="smcsAmountLabel"> <%#...
3
7500
by: Simon Tamman | last post by:
I've come across an interesting bug. I have workarounds but i'd like to know the root of the problem. I've stripped it down into a short file and hope someone might have an idea about what's going on. It's a simple program that loads a control onto a form and binds "Foo" against a combobox ("SelectedItem") for it's "Bar" property and a...
0
1122
by: =?Utf-8?B?TWlrZSBNaWxpYW4=?= | last post by:
I have a dropdownlist control in a formview and I am trying to enable 2 way databinding. Only, the option is not available. I look at the "Edit Databinding" option of another DDL control in the same formview and it is available The only difference is that the DDL (where the two-way data binding property in not available) is inside a panel...
2
4500
by: =?Utf-8?B?Q29sb3JzdG9uZQ==?= | last post by:
Hi, I have a TabContainer inside a data bound FormView (to logically group the form fields into different tabs). The display part of the data binding works fine, but the Update doesn't. Basically the FormView cannot find the TextBoxes inside the tab container's tab panels. Some of the forums say that it's because of the TabContainer's...
0
7664
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7885
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8106
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7948
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6250
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5484
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.