Web Forms :: Added Multiple Dynamic Controls To A Tab Control?
May 25, 2010
I am developing a call center application. The way it works is it read records from a database and from these it creates dynamic questions and either textbox or dropdown controls on one of about 5 tabs. The questions can change depending on the previous answers, thats why they need tgo be dynamic. The issue is the postback will loose the controls I have created. I thought about maybe just keeping a hashtable of the controls in the session and then recreating them each page create. The trouble is the page flicker. what the best way to handle this ??? I've though about update panel manipulation but nothing seems to work the way I need it to.
I have a dropdown on page, a place holder and a save button on my form.Now, I am creating a textbox on selectedIndexChanged event of dropdown list and adding it to placeholder. And on button click I want to access the control, but on click event, I find the textbox as null. Here is my code
my gridview column coming from database dynamicly it may be 10 or it may be 20. i added a blank row in grid throughdata table . i want to write something in this row and change color.
For the following link I kept 1 drop down box named as certification(yes/no),once selected item is 'yes' mean remaining two textboxes enabled otherwise disabled, it can be achieved through javascript.
but, the problem is once row adding dynamically the enabled two textboxes are getting disabled automatically in the previous row, how can i resolve this
i have to access Textbox and check box values at same time those check box and text box created at run time .i know how i can retrive single controll but problem is that i want both control values at same time to add them in database
I want to write a program to click a button to save a record. A confirmation window will show up before the record actually save to database. Once confirmed, it will show a modal popup.Here is the code:
[Code]....
The problem is, the Modal Popup shows up before the confirmation windows. Is there any way to control the execution sequence of AJAX controls?
I am having datagridview control with dynamically added BoundField columns.I want to have tetxboxes in each cell of the gridview so taht user will enter data in gridview textboxes and at last on button click it will be saved in database.
I add linkbutton controls dynamically to a panel, this works fine, but I also add eventhandlers to them like this.. AddHandler mLink.Click, AddressOf mLink_OnClick But when I click the linkbutton links, the event never happend. I have one updatepanel wrapped around some panels. What could be wrong?
I my application i have generated dynamic rows that contains some textbox values, i need to take those values and display in reports. I am storing that dynamically added values in another table.
XElement Categories = new XElement("Promotions", from b in db.GetPromotions() select new XElement("Promotion", new XElement ("Category",b.CategoryName), new XElement("Client",b.ClientName), new XElement("ID",b.ID), new XElement("Title",b.Title))); XDocument mydoc = new XDocument(); mydoc.Add(Categories); try { // Load the style sheet. XslTransform xslt = new XslTransform(); xslt.Load(@"C:WebDesktopModulesPromotionsTransList.xslt"); // Execute the transform and output the results to a writer. StringWriter sw = new StringWriter(); //XsltSettings mysettings = new XsltSettings(); XmlWriterSettings mysettings = new XmlWriterSettings(); xslt.Transform(mydoc.CreateReader(),null, sw); String mstring = sw.ToString(); It generates the following string: <ul id="red" class="treeview-red" xmlns:asp="http://schemas.microsoft.com/ASPNET/20"> <li><span>Arts & Entertainment</span><ul> <li><span>Client 1</span><ul> <li><span><asp:LinkButton ID="LinkButton2" runat="server" OnClick="LinkClicked" Text="Get your Free 2" /></span></li> <li><span><asp:LinkButton ID="LinkButton4" runat="server" OnClick="LinkClicked" Text="Get your Free 4" /></span></li> <li><span><asp:LinkButton ID="LinkButton5" runat="server" OnClick="LinkClicked" Text="Get your Free 5" /></span></li> </ul> </li> </ul> </li> <li><span>Community & Neighborhood</span><ul> <li><span>Client 2</span><ul> <li><span><asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkClicked" Text="Get your Free 1" /></span></li> </ul> </li> </ul> </li> <li><span>Education</span><ul> <li><span>Client 3</span><ul> <li><span><asp:LinkButton ID="LinkButton3" runat="server" OnClick="LinkClicked" Text="Get Your Free 3" /></span></li> </ul> </li> </ul> </li> <li><span>Home & Garden</span><ul> <li><span>Client 4</span><ul> <li><span><asp:LinkButton ID="LinkButton6" runat="server" OnClick="LinkClicked" Text="Get your Free 6" /></span></li> </ul> </li> </ul> </li> </ul>
Now I take the string and add it to a panel which is part of a view in a multiview control: Panel1.Controls.Add(new LiteralControl(mstring)); I have tried to play with Page.ParseControl, but I cannot get it to work right in the panel, the linkbuttons do not show, even though the text is there in the source. Now I tried this: Control myctrl = Page.ParseControl(mstring); Panel1.Controls.Add(myctrl); and I get this as the one of the controls:
a id="dnn_ctr954_ViewPromotions_LinkButton2" href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("dnn$ctr954$ViewPromotions$LinkButton2", "", true, "", "", false, true))">Get your Free 2</a>
It doesn't work the way expected, dotnetnuke is doing some nutty stuff here using the parse control. it seems to drop my LinkClicked event.
I have a composite user control consisting of three standard table cells (a legend, an image with a tool tip, and a text field control). If I add these to a TableRow in my aspx page it works fine and produces legal HTML in my source. The below works fine ...
However when I try to do the same programmatically (C#) the TableRow won't accept anything in its Controls collection that isn't a TableCell. I could make my control a nested table in its own right but I lose the alignment of my form items on the page with multiple controls, as each table aligns itself according to its contents. Is there anyway I can make the TableRow accept my control as collection of cells or do I need to do some casting or making my user control inherit some kind of TableCell attributes? I can also dynamically add my controls to a TableCell item which actually displays OK in IE but creates illegal HTML (<td><td></td><td> ... </td></td> - I assume this is illegal) in my resulting source. The code below DOES NOT work ...
The gist of the problem is that we have an alumni table (one record per person) and also a couple of other tables (one to many) that have degree info and interest info. In a search screen in our app you can search for criteria that spans all three tables (there are actually more fields and tables than shown in the example below but I am trying to keep it simple).
The code below works (properly returns people without degrees for example) but still feels a little clunky or over-engineered to me. Are there easier ways to do this? NOTE: I have been through quite a few iterations/approaches to making the correct data be returned.
I have an application that needs to render a page that will have multiple Radio Button Groups as well as multiple CheckBoxes. The desired layout is determined by a database table.
This table defines a "Package". The "Package" can contain many different "Items" that require different controls used in the View. The "RadioGroupName" field is used to mark which RadioButtons should be grouped together. The "ViewControl" field marks which control should be used on the View to display the field. The query in my repository will return a result set such as
Given this result set, I need to render the view as follows:
A RadioButton group with 3 options (Item1, Item2, Item3) A CheckBox (Item4) A CheckBox (Item5) A RadioButton group with 3 options (Item6, Item7, Item8)
I have read that it is possible to use "if" conditions and looping structures inside the View. I have also read that this is a bad practice. Another issue I see is knowing which Item has been selected from each RadioButton group when I hit the Controller POST function. Previously I have built a page that has a single RadioButton group. My ViewModel was as follows: