0

I'm looking to have it so that if someone enters information in a form, and saves it to the database (MSSql, this part works) that a new form if made, preferably from a template form, which will only show the data for that field in the database. I would like the name to be a name the user enters in the previous form. I have searched around on Microsoft's ASP Forums and MSDN Forums, but nothing was of much help. If this is possible, could someone please give me links. And just in case you need this, I'm using VB.

Edit:

Sorry if it didn't make sense.

What I want to do is have a template form, as the info to be displayed for each record is going to be the same format.

What I'm building is a concert ticketing system. So, I want to have it that the admin is able to, and this part isn't a problem, fill in a form which will save te concert details in my database. That's cool. But once he hits submit and everything goes through, I want a copy of a template page to be made, with the name of the concert as the file name, which will form the URL name. I also then want it so that on another page, each of the concerts is listed (i can do this) so a user can select the one they want to, and it will bring them to the page with the URL corresponding to the title they pressed. But then, I need it so that the new page I made will only load the record corresponding to the concert it was made for.

Eg. If the admin makes a concert named 'Charity Concert', I want the template page to be copied into the name 'Charity-Concert' or something like that so it is easy to identify. Then on the other page, a regular user comes along, wants to buy tickets for this Charity Concert. All the current concerts are listed down the page, they choose the Charity Concert link, and up comes my new page with the name 'Charity-Concert'. And the record which is shown in this page is only the info for Charity Concert though, I don't want this new page to show all the records in my table.

Hope that clears things up, and thanks to those who have already answered.

kaiz.net
  • 1,984
  • 3
  • 23
  • 31
Andre C
  • 457
  • 1
  • 9
  • 26

4 Answers4

0

I'm not sure i understand your question 100% but I found a nice video on youtube (here) that shows you how to dynamically add controls to a windows forms application and it's in VB (which is nice for you)

EDIT: Sorry I could have sworn you were after windows forms (my bad)

Here are some links to information about dynamically creating (asp.net) forms:

Is that what you are after?

Robbie
  • 18,750
  • 4
  • 41
  • 45
0

If you're using WebForms, this series of articles is kind of the classic explanation for how to do "Dynamic Controls in ASP.NET": https://web.archive.org/web/20211020131055/https://www.4guysfromrolla.com/articles/081402-1.aspx

Michael Levy
  • 13,097
  • 15
  • 66
  • 100
0

So basically you're asking how to build a website? =)

I'd look into URL routing to generate pages based on titles.

https://web.archive.org/web/20211020111718/https://www.4guysfromrolla.com/articles/012710-1.aspx

So by hitting mydomain/events/my-event-name/ you can make the query just from that.

You can use the URL routing variables to know what event to look up, then you can load in the appropriate HTML template from a file, write that to the page and insert the variables you need in the input forms.

for some more on HTML templates: Can I set up HTML/Email Templates with ASP.NET?

Community
  • 1
  • 1
FlavorScape
  • 13,301
  • 12
  • 75
  • 117
-1

Assuming you're not using a forms application

There are a ton of ways to do this. If you really want to get into templating, could use entity frameworks etc. or define structs with the HTML you wish to render and associate them with your data.

But for now, the basic premise. On the second form, query your database with a passed in ID or name in the query string so you know whose data to load. You will want to be in an authenticated environment by now, or any user could read any other users data. Anyway, use the query value on the second page to do your query.

 pseudocode: get value from query string 
 c# string id= Request["id"];
 pseudocode: lookup your database based on ID
             string myValueFromDatabase = query result from username field

Once you have your values just write the response to the HTML. sorry, using c# syntax because I don't know VB.

So, inline page

    <% Response.Write( "<input name=\"" + username + "\" value='"+myValueFromDatabase+"'/> %>
FlavorScape
  • 13,301
  • 12
  • 75
  • 117
  • -1 Does not make sense, why should he use entity framework to solve sth. that is not database agnostic. What has the used language in common with a coding problem. – Andreas Mar 22 '12 at 20:28
  • @Andreas I'm saying the entity framework is the complex alternative. secondly, my code didn't render correctly the first time. I'm simply illustrating how to write out an input field based on query results. – FlavorScape Mar 22 '12 at 20:54