dynamic-controls

Dynamic data-entry forms in Silverlight.

We are investigating how to create data entry views from a dynamic list of pre-defined field definitions. By "pre-defined", I mean that there are only 8 basic field types. The Silverlight Toolkit's DataForm control is almost what want, but it targets object properties (not a list of custom definitions). Is there an existing project to...

accessing data from a dynamically added custom control.

I am writing a survey generating system in asp.net. i asked an ealier question about the best way to create controls that can be passed about as variables. This was problematic with user controls so i was advised to use custom controls and a quick way to do this was to inherit from the panel control and just add a bunch of standard co...

Best way to design recursively dynamic asp.net web controls

I have a been given a task to create GUI for something that could be used for bunch of different scenarios. And its a bit of mind teaser problem. We have a set (sql table)of question entities in model which has a parent_id relationship to other question entity. If entity has nothing in parent_id fields.. that means its a level 1 entity ...

How to bind a function to "Click" event of a dynamically added ImageButton?

Hi, I am completely new to Asp.net. I am currently working on a asp.net page coded via Visual Basic On the page I have these image buttons that are dynamically generated based on the SQL Data the page retrieves. Unfortunately I could not figure out how to bind a click function to each of these buttons. the [Control Name].onClick = "F...

dynamic controls based on user postback

Suppose I have a treeview, where each treenode contains an id for a different set of user controls. When the user clicks a node, these controls should be loaded to the page. As I understand the ASP page life cycle, dynamic controls should be added in the initialization stage, and postback events will fire later on. So if the treeview ...

Nested Dynamic Controls, using Custom Event Handlers

I'm building a WinForm with quite a few dynamic elements, and I think I'm having some trouble with the parent/child relationship within nested controls. All the existing questions I could find seemed exclusive to WebForms, which wasn't entirely useful. I've also had some trouble with custom-made controls, but that may be a related issue...

Problem with events and ParseControl

I'm adding a control (linkbutton) dynamically using ParseControl and it's fine except when I specify an event handler. If I use: Dim c As Control = ParseControl("<asp:LinkButton id=""btnHide"" runat=""server"" text=""Hide"" OnClick="btnHide_Click" />") it correctly adds the control to the page but the click event doesn't fire. If ins...

How to read dynamical added check box?

Hi, I am adding checkboxes dynamically to silverlight stackpanel object as follows: foreach (String userName in e.Result) { CheckBox ch = new CheckBox(); ch.Name = userName; ch.Content = userName; ContentStackPanel.Children.Add(ch); } How do I read back those controls to detect which of them are checked. ...

Adding & Removing Dynamic Controls in C# WinForms.

I have three Tabs in my WinForm; depending on the selected RaioButton in the TabPages[0] I added few dynamic controls on the relevant TabPage. On Button_Click event the controls are added, but the prob is the I'm not able to remove the Dynamically added controls from the other (irrelevant) TabPage. Here's my code: Label label235 = new ...

Secure to store an ID in an ASP.NET control ID?

I'm auto-generating a form in my ASP.NET page. This is already tested and working. I want to know if: If there are any security problems with storing the database ID as part of my controls ID? I can see think of 2 issues: the id will be visible in page source (not really important in this case), and the possibility someone could change...

Adding Dynamic Controls

I have a page I need to build out where depending on the selection the user made on a form on the page prior it displays a different set of questions for them to answer. So say the user selects Reason A from the form on page edit, then it needs to display Questions 1 and 2 on page edit_confirmation. But if they select Reason B then it ...

What prevents a user from adding controls to an ASP.NET page client side?

This goes back to my other question which I thought was sufficiently answers but upon reflect am not sure that it was (sorry). Backgrounder: I am generating a form dynamically. I am pulling from the database the controls. I must associate each control with a database ID which is not the user's session id. I do this currently by storin...

Dynamically adding controls from an Event after Page_Init

Might seem like a daft title as you shouldn't add dynamic controls after Page_Init if you want to maintain ViewState, but I couldn't think of a better way of explaining the problem. I have a class similar to the following: public class WebCustomForm : WebControl, IScriptControl { internal CustomRender Content { get ...

ASP page get current focused control

So what I have is a bunch of dynamically created textboxs that when the user enters some data and either tabs out or clicks out some calculations are done. After the page posts back control focus is lost. What I need is to be able to set focus back to the control that was tabbed to or clicked into not the control that data was entered in...

How to name and find dynamically created webcontrols in c#

I am trying to add a unique name to each textbox that I'm adding to a table. I've tried: TableRow someRow = new TableRow(); TableCell someCell = new TableCell(); TextBox someTextbox = new TextBox(); someTextbox.Attributes.Remove("name"); someTextbox.Attributes.Add("name",itsId); someCell.Controls.Add(someTextBox); someRow.Cells.Add(s...

How to keep the state of dynamic controls in ASP.NET?

I am creating some dynamic textboxes through javascript, when postback is happening i am loosing the controls. I can't use Ajax instead of postback and i can't create dynamic controls from code behind. Can anyone please give any suggestion about it? ...

How to add persistent dynamic controls based on user input (not on intial page load)

I am familiar with creating and persisting dynamic controls on the first load of a page and on subsequent postbacks but I am having trouble with the following user initiated scenario... In my demo I have a placeholder, two buttons and a literal <div> <asp:PlaceHolder ID="phResponses" runat="server" /> </div> <div> <asp:Button I...

Iterating Dynamic FileUpload Control Collection in Panel Control using ASP.NET C#

Hello everyone, I'm trying to get the values of dynamically generated FileUpload controls that I add to a Panel: <asp:Panel ID="pFileControls" runat="server"> </asp:Panel> I create the controls during a loop through a record set: foreach(DataRow dr in ds.Tables[0].Rows) { FileUpload fu = new FileUpload(); fu.ID = dr["SomeID"...

Dynamically Created Controls or Static Controls that are Hidden or Shown

I've got a set of ASP.Net pages that display a number of asp:TextBox fields depending on the number of entries in a configuration file. I know that the number of fields won't be going above 10 or so. Given that, should I declare a sufficiently large number of text boxes in markup, or should I dynamically create the textboxes in the cod...

Where in the page lifecycle can I safely load/remove dynamic controls?

I'm working with dynamic fields in ASP.NET due to a very specifc and rigid end-user requirement that would take 2 hours just to explain. Suffice it to say, I can't make the requirement go away. Anyway, I have a working solution in place; no problems with controls loading, rendering or maintaining their ViewState. This is what my OnL...