Dynamic control post back value

*** edited by: master4eva ***

Please enclose your code in < code ></ code> tags (without the spaces). This will make your code easier to read online; therefore, encouraging a response to be faster. It is to your own benefit for your question to be answered in future.
I have already done the editing to include the < code ></ code> tags for this post.

I'm builidng a dynamic page with server controls inside a table based on data from sql table.

While myReader.Read()
Dim lbl2 As Label = New Label
lbl2.ID = "lbl2" & myReader1.GetString(3)
lbl2.Text = myReader1.GetString(4)
Dim txtbx1 As TextBox = New TextBox
txtbx1.ID = myReader1.GetString(3) & "yr"
txtbx1.MaxLength = 2
txtbx1.Width = Unit.Pixel(35)
Dim txtbx2 As TextBox = New TextBox
txtbx2.ID = myReader1.GetString(3) & "mo"
txtbx2.MaxLength = 2
txtbx2.Width = Unit.Pixel(35)
form1.Controls.Add(New LiteralControl("<Table border='0' cellpadding='0' width='90%'>"))
form1.Controls.Add(New LiteralControl("<tr>"))
form1.Controls.Add(New LiteralControl("<td width='30%' align='right'>"))
lbl2.Text = Session.Contents("skillcode" & myReader1.GetString(3))
form1.Controls.Add(New LiteralControl("</td>"))
form1.Controls.Add(New LiteralControl("<td width='14%' align='center'>"))
******************HERE IS WHERE I WOULD LIKE TO GET VALUE FROM TXTBX AND ASSIGN TO SESSION STATE ***********************************************
Session.Contents(myReader1.GetString(3) & "yr") = txtbx1.Text
form1.Controls.Add(New LiteralControl("/"))
Session.Contents(txtbx2.ID.ToString)= txtbx2.Text
form1.Controls.Add(New LiteralControl("</td>"))
form1.contorls.add(new LiteralContorl("</table>))
end while
When the page loads it will look somthing like this:
<table width="90%">
<td width='30%' align='right'>
<span id="lbl210KEY">10-Key</span></td>
<td width='14%' align='center'><input name="txtbx110KEYyr" type="text" maxlength="2" id="txtbx110KEYyr" style="width:35px;" />/<input name="txtbx210KEYmo" type="text" maxlength="2" id="txtbx210KEYmo" style="width:35px;" /></td>
<td width='2%' align='right'></td>
<td width='30%' align='right'>
<span id="lbl2AAAAA">AAA Acct </span></td>
<td width='14%' align='center'>
<input name="txtbx1AAAAAyr" type="text" maxlength="2" id="txtbx1AAAAAyr" style="width:35px;" />/<input name="txtbx2AAAAAmo" type="text" maxlength="2" id="txtbx2AAAAAmo" style="width:35px;" /></td>

I would like to assign session.contents value to the data in the textbox. I know I have to rebuild the controls and do something with viewstate but i'm not sure how.
I'm guessing another way is to do literal/placeholder...any help would be greatly appreciated.
5/27/2004 3:43:23 AM
asp.net.hosting-open-forum 4216 articles. 0 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 4

Please nobody has any suggestions on how i should do this?  If what I have is not clear please let me know. 

basically i'm looping through getting data and inserting them in specific cells.
* lable 1 *txtbox / txbox2 *
* lable 2*txtbox3 / txtbox4 *
*submit *
so on............ once the form is built, user will enter value int the textbox, click submit, and data within txtbox will be inserted into db.

I'm really at a lost here and need some quick help.
5/28/2004 4:17:36 PM
One thing that I am confused about: why don't you use the DataGrid control while in multiple edit mode? I am a bit short on time today but here is a good article on how to get the DataGrid into multiple edit mode:

-- Justin Lovell
5/29/2004 7:46:27 AM

Similar Artilces:

How to get value from dynamic control on Post-back
Hi All, This is my first post. The problem is about dynamic control. 1. In Page Load, I auto generated a datagrid.  Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load         Dim lmws As New LIMSWSV10.LIMSService         Dim ds As New DataSet         If Not IsPostBack Then             ds = lmws.GetResultValueForShippingJob(Request.QueryString("ShippingJobID")) ...

How to read values from dynamicly created controls when posted back?????
It seemed a good idea, making an “inquiry-tool”; users can put their questions + the way to answer (eg radiobuttons or textfields) into a database. Answers are written back into the same database. Using a placeholder I managed to get dynamicly user-written questions + ways-to-answer to the client-side. But here is the problem: How to read values from dynamicly created controls when posted back????? I really tryed very hard but I can’t. ........ Can anyone help me please?? Here’s my code: <%@ Page Language="VB" Debug="true" %> <%@ imp...

Value of Control created dynamically is not getting populated on post back
Hi I am creating a table at run time. If I put some value to textbox, its not getting populated after post back. If I do it on Page onInit event everything works fine.. but I cant do this as I have to make rows on button click. The code is like this Sub MakeTable() Dim ht As New Hashtable ht("1") = "1" ht("2") = "2" For i As Integer = 0 To 2 Dim tr As New TableRow For j As Integer = 0 To 1 Dim td As New TableCell Select Case (j) ...

How to maintain form controls value after user control post back?
 hello experts, I have created filter grid in asp.net & C#.My form design has contains 3 dropdown controls and Filter grid(User control).Its working fine(filter), but one problem arise.the form controls are clear when i filter a grid(post back).I tried to reterive values using view state, hidden controls, i got only null values.Anyone please help, its urgent to me. Its my user control code.FilterGrid.aspx<%@ Control Language="C#" AutoEventWireup="true" CodeFile="FilterGrid.ascx.cs" Inherits="FilterGrid" %><style type = "text/css&...

How to do post back in a dynamically created user control [provided that update panel is in the master page of the page where user control is added] {B/C of FileUpload Control}
I have a register my scriptmanager and place the update panel around contenttempalte for my pages int the master page. Now in one of my pages i am adding some user controls dynamically. In two of my user user controls I have FileUpload control which will not work under partial post back. So I want's full postback for them How could I do that {Provided that i am on the user control,which is inside the page ,and page have the contenttemplat...

Dynamic controls on post back?
Can someone explain to me how to read the values of a dynamic control on postback? I have a user control that creates a user-defined number of text boxes when the function load_page() is called. The user control also contains a button that says "submit" When the user click's submit i want to read the values in the textbox's, but I have NO idea how. Here is my code thus far: public void load_page() { for(int i = 0; i < number_images; i++) { TextBox txt_temp = new TextBox(); pch_product_description_add_image_list_holder.Controls.Add(txt_temp); ...

Forum test NNTP-Posting-Host and X-Posting-Host
This is written in a browser using the forums. -- Rudy Velthuis (TeamB) http://www.teamb.com Rudy, | This is written in a browser using the forums. I see it just fine. What browser? -- Q 04/25/2010 20:21:04 XanaNews Version [Q's Screwed-Up ToolBar Mods] Quentin Correll wrote: > Rudy, > > > This is written in a browser using the forums. > > I see it just fine. > > What browser? Forefox, but that doesn't matter. I wanted to see when X-Posting-Host (a custom header line the Embarcadero server genera...

How to request dynamic control when post back?
If the control is created on design time, when it post back then i can request that control by it's name eg. request.form("textbox1")But now I'm facing problem on request dynamic control when it post back. The control is generated programmatically and add to the form's control on page_load event.  But  when it post back,  i cant request that control by it's control name because the name is auto generated by the system. I  had view the html source code on the browser, the control that generated programmatically will have a name like "ctl01&qu...

Dynamic Controls and Post Back Problem
Hi, I am dynamically creating and populating DropDownLists in a age and i have this problem. The DDLs are created fine, they are popultaed fine, but when the user is choosing a value from them, how do i retrieve those values so i can do something with them? I am thinking it has something to do with IsPostBack, because i got as far as capturing the original values, but not the newly selected ones. Here is my code: Sub BuildAttributeDDLs()     Dim i As Integer    For i = 0 To ProductDS.Tables(0).Rows.Count -1         Dim R...

deletion Dynamic control after a post back
hello my best friend ; I've ah simple .Aspx file that when I create a dynamic control on page withouy any problem but when  arise a event in other control , this control that dynamically added has been deleted.why happen this and how i can restric this? Thats bcoz you have placed the code for creating dynamic controls in this if not isPostBack Then  'Create Controls End if Hence they are created when the page loads since the condition is true But when a control does a postback this condition is false hence your controls are not recreated So remove the code for creati...

Menu control : Cross page posting and posted values in nested controls?
I've created a dyrnamic template for a menu control which renders either a textbox or a linkbutton. The textbox acts as an search input field. The value of this field then acts as input to another page(on another frame actually). What happens is that clicking on the linkbutton will do a postback to Main.aspx(which resides in a frame called 'MainWindow'). When the value arrives at Main.aspx, I see the value from 'searchMovies' textbox posted into the Request.form collection as : 'NavigationMenu$ctl05$searchMovies' with the value that was keyed in. From main.aspx, does anyone know...

Dynamic controls not displaying when the page is post back
if (!Page.IsPostBack){ string plyr = "<embed src='../Players/flvplayer.swf' width='540' height='364' bgcolor='#FFFFFF' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' flashvars='file=../Video/SWF/" + vfname + "&autostart=false&frontcolor=0xCCCCCC&backcolor=0x000000&lightcolor=0x996600&showdownload=false&showeq=false&repeat=false&volume=100&useaudio=false&usecaptions=false&usefullscreen=true&usekeys=true' allowfullscreen='...

Getting back the values of dynamically created controls...
Hello, If you have a set of input controls that have been generated dynamically, say from values in a database, and after building a form page with those inputs, you want to collect the values again and update the db. However, you don't know how many inputs there are going to be. How do you efficiently gather all the information from your controls given you dont know the ids or the types of the controls??? (Is this a case where you would want to store a couple delimited strings in the viewstate to keep track of the Ids and input types?) Thanks... Actually, Just figured it out... ...

Post back clears out the value in Input Control
 Dear All, I am using html input control to upload images to database (with browse button). it is running at server. when I click on button to send data to Database, it clears out the file path or browsed file due to postback.any idea to read the file path before it clears out with click of send button.Thanks,  Can you post the code? Do you have EnableViewState="false"?CheersAlMy BlogMapStats.NETPlease click on 'Mark as Answer' if this post answered your question!  Are you talking about EnableViewState for Input control, if yes, then before it had no...

Web resources about - Dynamic control post back value - asp.net.hosting-open-forum

Dynamics - Wikipedia, the free encyclopedia
Brownian dynamics , the occurrence of Langevin dynamics in the motion of particles in solution (e.g. a grain in water, as was first seen by Brown); ...

Datacenter Dynamics
Datacenterdynamics for data center information, conferences, news, videos, whitepapers and reports globally

Dynamic Chiropractic - chiropractic, news, articles, research & information for chiropractors - Find ...
Dynamic Chiropractic - chiropractic, news, articles, research & information for chiropractors - Find a Chiropractor

Paul Melville: a dynamic talent taken before his time
What might have become of a popular young cricketer with the world at his feet?

Lenovo and Apple: PCs’ Dynamic Duo, Gobbling Up Share in Downbeat Market
... in units sold, with gains in market share for top vendor Lenovo Group ( 0992HK ), and for Apple ( AAPL ), who turned out to be the Dynamic Duo ...

Seattle Councilmember O'Brien: Power dynamic between Uber, drivers is out of balance
Seattle is the first city in the U.S. to give Uber drivers the right to form a union, but whether that actually happens might be up to the courts. ...

dynamic billboards to up your photo game
NYC is one of the most photographed places in the world, especially this time of year. And while Instagram has made every one of us feel like ...

SNL perfectly captured the dynamics of the Republican presidential race
The "Saturday Night Live" recap of the latest Republican presidential debate reflected fairly accurately the state of the GOP primary. Beck ...

Boston Dynamics wishes you a terrifyingly happy holiday
Whether you think holiday greeting cards are touching or annoying, Boston Dynamics is celebrating the season just a little differently with this ...

Are Boston Dynamics' Robot Reindeer The Ghosts Of Christmas Future?
Either that, or the nightmare before Christmas. The Google-owned robotics company Boston Dynamics delivered a unique holiday greeting this week: ...

Resources last updated: 1/15/2016 6:25:28 AM