Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamically creating a web page 1

Status
Not open for further replies.

andyd273

Programmer
Nov 2, 2005
21
0
0
US
I have a web part that pulls information from a database, puts it into a table and displays in on the web page.
My boss wants me to take the table with the information in it and put it into another web page.

I'm using vb.net 2003 to do the writing, and I'm fairly new to this side of things, and so I dont know how to make this work.

two ways I can see it working (though I dont know how to accomplish either, yet) is to either compile all of the html for the table, and then somehow magically create a new blank browser window and put the table html in as the body.
Or have a second webpage/webpart that has the functions it needs to compile the table, and somehow pass the needed information to look up the correct record from the database.

My problem is that I dont yet know enough to make either of these work, and am having trouble finding this stuff anywhere online or in books. if anyknow knows how to do either of these or knows of something that will work better and can give me a hint as to where to look for a solution, I will be very grateful.
 
Its the passing of information between webparts, especially webparts on seperate pages, that I dont know how to do.

He basically wants the list of customers on the main page, and the fact sheet to show up on a second page.
What is a good resource to looking up how to do this?
 
So basically you want a master/detail type page setup? the first page has the master, then you choose one, and the second page has the detail?
 
How are you displaying the Master data? Is it just in a table? How are you going to allow the user to select a row?
Or are you using a datagrid or gridview?
 
Datagrid
the first section of the table:

/code

dgCustomer = New DataGrid
Dim newColumn As BoundColumn
Dim btnColumnSelect As ButtonColumn

dgCustomer.AllowPaging = False
dgCustomer.HeaderStyle.Font.Bold = False
dgCustomer.HeaderStyle.BackColor = Drawing.Color.DarkBlue
dgCustomer.HeaderStyle.ForeColor = Drawing.Color.White
dgCustomer.HeaderStyle.Wrap = False
dgCustomer.GridLines = GridLines.Both
dgCustomer.SelectedItemStyle.BackColor = Drawing.Color.AliceBlue
AddHandler dgCustomer.SelectedIndexChanged, AddressOf myGrid_IndexChanged
dgCustomer.AutoGenerateColumns = False

btnColumnSelect = New ButtonColumn
btnColumnSelect.ButtonType = ButtonColumnType.LinkButton
btnColumnSelect.CommandName = "Select"
btnColumnSelect.Text = "Select"
btnColumnSelect.Visible = True
dgCustomer.Columns.Add(btnColumnSelect)

/end code

the rest of that function sets the rest of the cells, and then else where I read the data in from the database and fill in the lines.
The customer is selected by clicking on a button, which pulls in more data, and that generates a html table with all of the stuff filled in.
 
When the user clicks on the select button, grab the key value for that row, then pass that to your details page, and query the database again to get the detials and display them.
 
That sounds like a good idea, but for some odd reason I'm having trouble finding anywhere that tells how to do that.

Also, does it make a difference on how you do it if its part of a sharepoint portal page?
 
something like:
Code:
Private Sub dg1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles dg1.SelectedIndexChanged
   dim key as integer
   key = dg1.DataKeys(e.Item.ItemIndex)
   Response.Redirect("YourDetailsPage.aspx?ID=" + key.ToString)
End Sub

Your Details Page
Code:
'In the form_load evetn
dim Id as integer = Request.QueryString("ID")
''Use ID for your queery

you can also use a session variable if you like

Jim
 
Thanks for the tip.

I'll give that a try (possibly next week, as its just about time to go home for the day)

Much thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top