8 Replies - 1723 Views - Last Post: 01 July 2010 - 06:17 AM Rate Topic: -----

#1 Needanswer  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 61
  • Joined: 27-January 10

how to use the other form in web application?

Posted 27 June 2010 - 07:42 PM

I need to refresh the gridview values on the other form, how you code this - SettingManager.DataSource = dt.....Error
SettingManager.Databind()......Error
I cannot code this way, it said - not defined the SettingManager, how to define it actually? Thanks.

Private Sub BindGridView()
' Code to retrieve records from database and fill it in a DataTable and Bind it to GridView
        Dim dt As DataTable = New DataTable()
        Dim conn As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=C:\Users\user\Desktop\honor.mdb")
        Dim da As OleDbDataAdapter = New OleDbDataAdapter("SELECT * FROM anndep", conn)
        conn.Open()
        da.Fill(dt)
        da.Dispose()
        conn.Close()

        GridView1.DataSource = dt........ERROR
        GridView1.DataBind().............ERROR
    End Sub


Is This A Good Question/Topic? 0
  • +

Replies To: how to use the other form in web application?

#2 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1533
  • View blog
  • Posts: 5,972
  • Joined: 21-March 08

Re: how to use the other form in web application?

Posted 28 June 2010 - 04:25 AM

can you give us the error?
Was This Post Helpful? 0
  • +
  • -

#3 Guest_needanswer*


Reputation:

Re: how to use the other form in web application?

Posted 29 June 2010 - 06:55 PM

View Posteclipsed4utoo, on 28 June 2010 - 03:25 AM, said:

can you give us the error?


Because the web application doesn't take -
GridView1.DataSource = dt........ERROR
GridView1.DataBind().............ERROR
(this is the error, because the class needs to be defined, supposed like this, "Lab.GridView1.DataSource = dt", but not for the web application,how you defined "Lab"?)


My question is how you code this - Lab.Gridview1.DataSource = dt, "Lab" is the other web form application, if on the regular windows application base, we can code like this "Lab.Gridview1.DataSource = dt", but not on the web application.


Thanks.
Was This Post Helpful? 0

#4 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1533
  • View blog
  • Posts: 5,972
  • Joined: 21-March 08

Re: how to use the other form in web application?

Posted 30 June 2010 - 05:35 AM

The web doesn't work that way. You can't "reference" another web form and the objects on that web form.

What are you trying to accomplish? Why are you trying to update a control on one web page from another web page?
Was This Post Helpful? 0
  • +
  • -

#5 Frinavale  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 205
  • View blog
  • Posts: 776
  • Joined: 03-June 10

Re: how to use the other form in web application?

Posted 30 June 2010 - 06:18 AM

Are you talking about having 2 browsers open: one showing WebForm1 and another showing WebForm2?
Are you trying to have WebForm2 update something in WebForm1?
Are both of your WebForms in the same project?

-Frinny
Was This Post Helpful? 0
  • +
  • -

#6 Guest_NEEDANSWER*


Reputation:

Re: how to use the other form in web application?

Posted 30 June 2010 - 06:08 PM

View PostFrinavale, on 30 June 2010 - 05:18 AM, said:

Are you talking about having 2 browsers open: one showing WebForm1 and another showing WebForm2?
Are you trying to have WebForm2 update something in WebForm1?
Are both of your WebForms in the same project?

-Frinny


Yes, Frinny.
Was This Post Helpful? 0

#7 Frinavale  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 205
  • View blog
  • Posts: 776
  • Joined: 03-June 10

Re: how to use the other form in web application?

Posted 30 June 2010 - 07:10 PM

"Yes"?....I asked 3 questions!
Well I'm going to assume that "yes" is yes*3 ;)

You are going to have to use Javascript to update the parent web browser (using the window.opener property). Pretty much, when a particular action happens in the child window you use the window.opener property to call a Javascript method that is located in the parent window. This Javascript will need to cause a post back to the server to refresh the grid.

Since the aspx page in the child window has data that needs to be shared with the aspx page being shown in the parent window you need to store this data where both aspx pages have access to it. I recommend using Session for this purpose.

-Frinny

This post has been edited by Frinavale: 01 July 2010 - 06:21 AM

Was This Post Helpful? 0
  • +
  • -

#8 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1659
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: how to use the other form in web application?

Posted 30 June 2010 - 07:46 PM

I could be wrong here but I dont think you can update something that is in a separate instance of a web browser. Say if I open Firefox 2 times, I cannot access instance 2 from instance 1
Was This Post Helpful? 0
  • +
  • -

#9 Frinavale  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 205
  • View blog
  • Posts: 776
  • Joined: 03-June 10

Re: how to use the other form in web application?

Posted 01 July 2010 - 06:17 AM

You are right PsychoCoder, but if one browser was a child of the other this is possible.

Typically if 2 browser windows need to interact with one another, one browser window is a parent (the original window) and one is a child (the window that was opened from the parent window). I assumed this was the case here anyways.

If Needanswer opens 2 browsers (as opposed to one browser window being opened from another), in this case there is no parent/child relationship between the two windows and my answer will not work.

-Frinny

This post has been edited by Frinavale: 01 July 2010 - 06:19 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1