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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multipage and grid Control datasource

Status
Not open for further replies.

ISPrincess

Programmer
Feb 22, 2002
318
US
I had a grid control that was assigned it's data source and bound in the Page_load event: this worked fine.


ie:
grdVehicle.DataSource = objcmd.ExecuteReader(CommandBehavior.CloseConnection)
grdVehicle.Databind()

Now i need to use Multipage w/ tab strip. The grid will be on the first page (selectedindex = 0) of 2 pages.

The above formload event no longer recognizes the control named grdVehicle in order to load the data into the grid.

Can anyone tell me where I should put the code? What is the difference between the fact that it is now on a multipage?


PH
I was walking home one night and a guy hammering on a roof called me a paranoid little weirdo.
In morse code.
-Emo Phillips
 
ISPrin: As a first approximation you should of course have the datagrid populated on load and on selected index changes, I would use something like the following:

Sub Page_Load(...
getGridRoutine()
End Sub

Sub GridRoutine()
'connect, bind grid here
End Sub

Sub IndexChange(sender As Object, e As EventArgs)
GridRoutine()
End Sub

 
Page load should have been: GridRoutine, not "getGridRoutine" (typo)
 
Thank you - I did get it to work ok, but ...

I also have buttons on the multipage 'pages' - do you know the best way to access/write the onclick event for those? (or any controls for that matter).

I am new to asp.net and was just getting used to the vb-like syntax (ie: button1_onclick) and just had it ripped away from me.

Thanks for your help (as always)

PS. I have posted a similar question on the forum under thread: Tabs in a Webform


PH
I was walking home one night and a guy hammering on a roof called me a paranoid little weirdo.
In morse code.
-Emo Phillips
 
Following is a sample of the code that I had when the buttons were simply on the aspx - and not within a multi-page:

Code:
Private Sub btnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        If btnEdit.Text = "Edit" Then
            btnEdit.Text = "Cancel"
            btnSave.Enabled = True
            btnRebalance.Enabled = True
        Else
            btnEdit.Text = "Edit"
            btnSave.Enabled = False
            btnRebalance.Enabled = False
        End If
    End Sub

As you can see, I am just trying to manipulate the other buttons on the same multipage but the error states that btnEdit is not declared, btnSave is not declared, btnRebalance is not declared. These are their ID's on the multipage HTML though.


PH
I was walking home one night and a guy hammering on a roof called me a paranoid little weirdo.
In morse code.
-Emo Phillips
 
IsP: Are you working in Visual Studio IDE? Are you using separate code behind pages are mixing code + HTML?
 
Yes I am working in VS.

I was hoping to continue to work with in the .net default environment of code behind pages.

PH
I was walking home one night and a guy hammering on a roof called me a paranoid little weirdo.
In morse code.
-Emo Phillips
 
PH: I see you have solved you problem in the a similar thread - glad to see you got it solved.
 
Yes - thank you - I am sorry I forgot to update here.

PH
I was walking home one night and a guy hammering on a roof called me a paranoid little weirdo.
In morse code.
-Emo Phillips
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top