How to create web form items dynamically

I have a list item in database, I want to retrive the items, then create a web form, each item has two paralleled textboxes that allow user input budget and explanation, like

List Item -------------- Budget ----- -------------------Explanation

Travel ----------------- 2,500(textbox) -----------------Training Fee(Textbox)
Hardware------------- 1,500(textbox) -----------------PC(textbox)
Software-------------- 700(textbox)--------------------Photoshop(textbox)

List Item will come from database.
How can I do that? (I really want to back to CLASSIC ASP. .NET is so annoying!!!!)
Thanks.


"Object reference not set to an instance of an object"
0
che3358
1/7/2004 8:00:58 PM
asp.net.getting-started 91979 articles. 3 followers. Follow

2 Replies
515 Views

Similar Articles

[PageSpeed] 45


If only thing you need is to retrieve the data and display them on the page then you need to read basic book or tutorial on ADO.NET and databinding.
You can strat with Quick Start tutorial:
http://asp.net/tutorials/quickstart.aspx
Or lookup in Google for tutorials.
And don't give up. Once you start learning you'll never wish again to go back to classic ASP.
0
almir_1
1/8/2004 9:37:17 AM
Thank you for your response, and especially thank you for your encouragement. 

At least, I think CLASSIC ASP is mora simple thatn ASP.NET in this issue. Let us take a look.
Suppose I got the data from database, then I use the following code
<%
For i = 1 to WhateverQuery.RecordCount
<tr>
<td>WhateverQuery("Items")</td>
<td><input type="text" name="Budget<%=i%>"></td>
<td><textarea name="Explanation<%=i%>"></textarea>
</tr>
Next
%>
That is it! I have got the unique NAME for each item.
I am trying ASP.NET right now (Maybe it is not the best way). First, get data from database; second, set couple of PlaceHolder, third, create new LABEL, TEXTBOX like --
For i = 1 to whateverQuery.count
Dim lbli As Label = new Label
Dim newControllbl = FindControl("lblBudget" & i)
lbli.text = i
lbli.visible="true"
newControllbl.controls.Add(lbli)
Dim txti As textbox = new textbox
Dim newControltxt = FindControl("txtBudget" & i)
txti.ID = i
txti.text = i
txti.visible="true"
newControltxt.controls.Add(txti)
Next
It works basically. But, I still have problem. First, I have to set PlaceHolder manually according to database record (I am trying to set up it in the above loop). Second, validation.
Please let me know if you have good iead.
Thanks.

"Object reference not set to an instance of an object"
0
che3358
1/8/2004 4:07:41 PM
Reply:

Similar Artilces:

Help getting started with a dynamic web form
I'm new to .NET so I was hoping someone could point me in the right direction. I have a form that needs to be dynamically created based on the contents of a XML file. The XML contains data for each 'row' to be created and what type of fields (textbox, custom select box, etc) should be displayed. The number of each type of field will vary from time to time. Using ASP I would have either used XSL to create a form or DOM to walk through the contents of the XML and display/name the proper fields. Using .NET I'm not sure what the proper method is to accomplish my goal. I can use XML c...

getting start with vb.net and crystal repots(web form)
I use Crystal Report9 in Visual Studio.NET 2003..... Example at Northwind database I want a application that.....a form include a combobox that contain CustomerID.....If I choose one CustomerID and click OK button....a Report will display information about this Customer......I think that must use Paramater.....how to do that ???? (How do I start to coding --please step by step or sample) please help me !!! Thank you so much!!! very good I have Dropdownlist when I choose the 'month'--> the all data of this field will show I use this Private Sub ddlMonth_Sel...

Getting the Selected Item of dropdownlist inside Web User Control on a Web Form
Ive got a dropdownlist control inside a web user control called Entity.ascx. This web user control is on a webform.aspx. In Entity.ascx class I created a SelectedEntity property that returns the selected item in the dropdownlist. Inside webform.aspx when btnGo is pushed I set a string and pass it in the url. I am trying to get the entity they selected via the property (SelectedEntity) inside Entity.ascx. As the SelectedEntity property tries to return the selected item in the dropdownlist I get this error: System.NullReferenceException: Object reference not set to an instance...

Creating dynamic web forms
Hello, all,I come to you at the heights of despair, after long searches and sleepless nights, so I hope you can provide an answer.I have a particular section of my web application in which I build textboxes based on information retrieved from the database -- that is, I cannot predict the number of textboxes, so I loop through the number of records in an ArrayList of Gentle.NET mapping objects and create a couple of textboxes for each row, retrieve the required information for display and so forth. All text boxes are then bound to a HtmlGeneric control that was pre-registered into the form an...

how to dynamically create a web form
here is my problem...I have a web form grid.aspx which i am opening in a new window whenever user makes a particular selection from dropdownlist... the thing is i am opening a new window everytime a different selection has been made from the dropdown.... using window.open('grid.aspx?selection attributes,'selection attribute'); my problem is that in my grid.aspx form i am using session variables so that variables for each window are different from other windows and no changes on one window would reflect on another because of these different session variables...but my problem will come whe...

Dynamically created controls in web form
Hi there. This is bit of an open ASP.Net (C#) question with regards to dynamically created controls and in particular tabular or panel controls. What I currently have is a web page that creates between 1 and 6  tables, each of which holds specific data about a set of products, each table (or panel, if you want) has a couple of multi-line TextBoxes and a few other controls, all lined up in a set format. The number is determined by the data records returned from a database table. My question is what is a best way to create these tables of data at run time?  Has anybody else had e...

Dynamic Menu item in Web form
Is there any one know how to show a run-time created menu object? Have you tried SKMMenu ?Sonu Kapoor [MVP] Feel free to ask me any .NET question | Ajax Data Controls Forum I have to build the dynamic menu by my own since the number menu items depending on the specification in the database. After I created the menu objedct, i dunno how to dsiplay the menu object on the browser. There are many third party menus available. All of them are designed to let you populate them at runtime. You can still write queries to your database then use the results to create the objects that they us...

Dynamically creating controls in Web forms
I am able to create a web control programmatically and display on the form. In the click event of the button then I am trying to capture the value entered in the above created textbox in another click of button but I am unable to obtain the reference of the control that has been created dynamically. Can anyone help me please? protected System.Web.UI.WebControls.Panel myPanel; private void btnMake_Click(object sender, System.EventArgs e) { TextBox txtBox = new TextBox(); myPanel.Controls.Add(txtBox); } private void btnGotValues_Click(object sender, System...

"Visual Studio .NET cannot create or open the application. Web site 'http://localhost/2373/Labs/Lab071' not started on this Web server. "
i wanted to create a New Project, with Visual Basic Projects as Project Type, and ASP.NET Web Application as the selected Templates. However, there was an error message pop up saying these: "Visual Studio .NET cannot create or open the application. Web site 'http://localhost/2373/Labs/Lab071' not started on this Web server. " How may i overcome it? Is 2373 already a directory in your web root? How about Labs? It might have something to do with subdirectories, have you tried creating one just off the route? Ala: http://localhost/labs071 ? You might want to try to see if tha...

Implementing .Net Form into an APS.net web form, can this be done
I am new here, but have been searching for a while, and may not have the correct lingo to find what I am looking for.  I am tasked with implementing a .exe application that was writen vb6 then converted to .net into a new website my team is developing. The idea is to put each of the 3 different forms in this .exe application of 3 different .aspx pages. I have attempted multiple things to get this into the page and even started to just rewrite it as an ASP.net web form, but even then I can't reuse any of the code since the System.Web.UI.Page doesn't inherit the sa...

Create .NET Web Forms Application in PB12
This is a multi-part message in MIME format. ---=_forums-1-dub4beb17fe Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Hi, I am getting an error whenever I try to create a new Webform app. The attached JPG has the screen, and the error message where I get the error. I have tried both creating a brand new app target, and tried creating one from an existing app. The error was the same either way. Anyone seen this yet? Running on Windows XP SP3. Thanks, Mike ---=_forums-1-dub4beb17fe Content-Type: image/jpeg; name="pb screen.JP...

How to Create Framed Web Forms in VS.NET?
Hi, I'm using Visual Studio.Net to create my web applications. In design view of a web form on the menubar there is a "Frames" option, but its contents are always disabled. I'm assuming that this option is there to let you create framed pages, right? Why is this option always disabled? Is it a setting in VS.NET that needs to be changed to enable them? How do you create framed pages in this environment? Is writing actual HTML the only way to do this? Any help is much appreciated. Thanks, Shawnsa4720k These options are only available to a Frameset page. You can add ...

Creating a web form in VB.NET 2003
I apologise if this has been asked a thousand times.  Firstly, I am using VB.NET 2003 (v7.1.3088) and .NET Framework 1.1.4322  SP1 on WinXP Professional SP2 platform with all security and critical updates in place.My background: good old FoxPro, VB6 and VBA under Access (yuk!)I am playing about with a test project before hopefully upgrading to VB.NET 2005 and i am having a fundamental problem with web forms for a ASP.NET web application.  Whenever I copy and paste an object (text box, label, etc) VB.NET pastes the object back onto the form apparently correctly.  After up...

dynamically creating html controls on web form
hello all, I'm creating html <input type="file" name="test" id="test" runat="server"> dynamically using Javascript on a .aspx page. when i submit the form i get Javascript "Access is denied" error. if i take out name attribute from input tag in javascript -  it is not throwing any javascript error but the file is not being uploaded to the server. Can anyone point me in the right direction? Thanx in advance     Maybe this is a security restriction imposed by the browser? I know there are several constrain...

Web resources about - How to create web form items dynamically - asp.net.getting-started

Placebase team at Apple file “Schematic Maps” patent dynamically detailing important data
In a report from Computerworld way back in 2009, we learned that Apple had quietly acquired Maps API company Placebase. Then, founder of Placebase ...

Apple's Lightning port dynamically assigns pins to allow for reversible use
... a closer look at how Apple's new Lightning connector works, and has come to the conclusion that the 8 pins on each side of the plug are dynamically ...

In a dynamically typed language, is it a bad idea to return different data types?
In some cases, returning different types from a single function works.

Urlbox Launches Screenshots-as-a-Service Platform to Dynamically Update Galleries
... changes. Launched yesterday, Urlbox allows anyone with a gallery displaying website screenshots to automate the process and keep them dynamically ...

Everything.me launcher dynamically adapts to what you’re doing right now
... phone according to what you’re doing. Perform a search for ‘football’ and your background will change to the NFL logo. A launcher that dynamically ...


A YouTube Experiment Resizes the Player Dynamically
There's a new YouTube experiment that changes the video player's size, depending on the browser window's size. When resizing Chrome's window, ...

Apple Granted “Dynamically Changing Cursor for User Interface” Patent, Originally Filed in 2003
... a utility patent that covers the use of the mouse cursor that changes according to the context of the task it is engaged in. Called a “Dynamically ...

Atmel's FPSLIC II Dynamically Reconfigurable SoC Supports "Silicon-Sharing" For Peripherals & Interfaces ...
Silicon-Sharing Fits 200K Gate Design into 40K Gate FPSLIC II's, Cuts Power Drain by 97%

Everything.me Launcher Wants to Dynamically Change Phones Based on Location, Interests, and Mental State ...
What if your phone’s launcher dynamically changed based upon interests, your location, or topics you had in mind at a specific moment? A new ...

Resources last updated: 11/24/2015 3:09:55 AM