473,698 Members | 2,217 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 1726
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
2343
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 data binding allows you to bind one data element to a control. In many situations you want to display...
2
1447
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
2720
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
2047
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
5334
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 handle OnSelectedIndexChanged for DDL1 that sets the FilterExpression associated with the...
1
1070
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"> <%# DataBinder.Eval(Container.DataItem,"InvoiceAmount") %> </asp:Label>
3
7513
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 datetimepicker ("Value") for it's "DateTime" property. The DateTimePicker.Visible value is set to...
0
1126
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 control. Would a DDL inside a panel control cause the two-way data binding property to be...
2
4503
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 implementation (by design) of "INamingContainer", and a hack is to take control of the TabContainer's...
0
9156
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9021
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8892
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8860
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7716
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6518
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4614
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
1998
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.