473,614 Members | 2,089 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding controls to Repeater during runtime

Hi:

I'm using the Repeater control to display one-to-many relationship between
Customer, Orders and Order Items. To do this, I bind the control to
Customer table to show customer data, then call a function from item
template to generate Order and Order items which are returned as a string
containing HTML markup tags.

Since the Orders and Order items tables are not bound to Repeater I can't
add a button template. The button will have as it's command argument the
invoice number I'll use to take some action. So- it appears I'll have to
add button programmitcally in function like so...

System.Web.UI.W ebControls.Butt on btn = new Button();
btn.Text = "Finalize Order";
btn.CommandArgu ment = child["invoice_no "].ToString();
Repeater1.Contr ols.Add(btn);

this correctly adds control to page but doesn't get wired up to Repeater's
Item_Command. How do you get it wired to Item_Command event so I can catch
the command argument?

Thanks,
Charlie
Nov 18 '05 #1
0 1201

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

Similar topics

1
6971
by: Jax | last post by:
I am looking to populate web page with controls as a result of a database query. eg (pseudocode) <% foreach(Garment g in GetStuffFromDB()) { //add controls Response.Write("<asp:Button id = 'Button'"+ctr.ToString() +"/>")
8
4272
by: Invalidlastname | last post by:
Hi, We are developing an asp.net application, and we dynamically created certain literal controls to represent some read-only text for certain editable controls. However, recently we found an issue which is related to the repeater. In the code shown below, if I call Repeater1.Controls.Count in the OnInit (the code fragment was highlighted in yellow) , the viewstate for the repeater will be lost during the postback. You can re-produce this...
3
3142
by: Fao, Sean | last post by:
I have a DataGrid that I'm adding CheckBox controls to at runtime (in the code behind) and I'm not sure if I'm doing it correctly. First of all, I noticed that the MyDataGrid.Columns.Add() method expects a DataGridColumn so I instantiated an object of type TemplateColumn that I had hoped I could add a CheckBox to. I soon discovered that the ItemTemplate property of the TemplateColumn class returned an object that had implemented the...
4
1348
by: volkmar rigo | last post by:
hi. is there a way to access the controls of a repeater template at runtime? i tried the GetFields method to extract all the controls of the repeater as FieldInfoArray but that array contails only ITemplate objects. i want to do this before i call the bind of the repeater so items are not available. kind regards
6
1589
by: Totto | last post by:
Hi, Anyone know the best solution to dynamically add buttons to a asp 2.0 page using data from Sql server? Are there any contols suitable for this or is it best to iterate the dataset and dynamicaly add buttons in the asp page? Totto
3
2234
by: Iain Buchanan | last post by:
Moving this code below from v1.1 to 2.0... am now getting this bug... After I bind a repeater I move the repeater inside the placeholder using controls.add(), but when I do this, all the children's clientids change - I also ran a test and then moved the repeater again into a third placeholder, and surely enough the clientid's change further. The only work around I have found is to bind the repeater again after I move the placeholder, but...
6
11067
by: | last post by:
I have made some user controls with custom properties. I can set those properties on instances of my user controls, and I have programmed my user control to do useful visual things in response to how those properties are set. I want to be able to do two other things: a) add User control instances to my page, filling in the place of placeholder controls, and b) programmatically setting custom properties on those dynamically spawned...
4
9050
by: John Kotuby | last post by:
Hi all, I am using a Repeater in conjunction with a SQLDatasource and SQL Server. One of the controls in the repeater is a HyperlLink as follows: <asp:HyperLink NavigateUrl='Search.aspx?page=base&amp;searchid=<% Eval("sequence")%>' ..... As you can see I am trying to pass a QueryString evaluated at runtime. All the other Evals of DataFields in the Repeater are working just fine. However this NavigateUrl is resolving as...
7
6191
by: =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= | last post by:
I'm adding subheadings to a gridview. Each sub head has a few link buttons. I'm adding the controls in the rowdatabound event code follows: sorry about the length here. I have to be missing something. The buttons show up and post back, but the events do not fire. any help would be appreciated!!! Thank you. protected void gvEntitiesRowDataBound(object sender, GridViewRowEventArgs e) {
0
8182
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8579
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
8279
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
8433
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
7093
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...
0
5540
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
4127
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1747
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1425
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.