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

Undesirable behavior w/ linkbutton

Status
Not open for further replies.

KDavie

Programmer
Feb 10, 2004
441
US
I have a linkbutton which is used to simply refresh summary data. The problem is that the button is on a parent form which contains an iFrame. When the button is clicked it updates the summary info on the parent form, as is should, but it also redirects the child frame back to its src page. Is there anyway to stop this from happening?

I thought about just using a label and writing a javascript function to postback to the server and run the code behind that updates the summary info but I wasn't sure if that would be a waste of time so I figured I'd get some opinions first.

Thanks in advance,

-Kevin
 
>>I have a linkbutton which is used to simply refresh summary data. The problem is that the button is on a parent form which contains an iFrame.

sorry unable to understand this. is your linkbutton in the iframe?

>>When the button is clicked it updates the summary info on the parent form, as is should, but it also redirects the child frame back to its src page. Is there anyway to stop this from happening?

Have you written any JS for this? How did you do this???

Known is handfull, Unknown is worldfull
 
Thanks for you reply...

The link button is not in the iframe, rather it is on the document the holds the iframe.

The summary info is updated from codebehind. I have a few classes in my data access layer which return the required tables. The function in my code behind simply calls those classes, returns the row count of the table, and sets some various labels text accordingly. For example:

Dim dt as datatable = dataAccess.SomeClass
dim intCount as dt.Rows.Count()
lblSomelabel = Ctype(intCount,String) & " Records."

In the onclick event of the link button I am calling the function to update the text of the labels.

I am not using any js to achieve this.

Does this make sense?


 
hi,

the problem is because whenever you reload the parent page the browser will also reload the child pages. therefore the only option would be to store data in the child page to a session, when it is loaded again we retake the data from session.

e.g.:
lets say your child class has 5 fields, the first time the page loads session values will be empty, you will set the values of the dropdowns to the session. now when the main page reloads (thus reloading the child page), the child page will read back the values from the session and set them to the dropdowns...

Known is handfull, Unknown is worldfull
 
Thanks again for your reply.

I don't think you understand my problem though. I'm not trying to maintain session state, so to speak. I am trying to stop the iframe from changing pages. I have a user control in the ifram that works as a tab control. Basically the user clicks on a tab and it redirects to the appropriate page. Now let's say the user is looking at the 3rd tab and decides to hit the link button on the form that hosts the iframe to update summary info. The summary info updates as it should but the iframe redirects back to tab 1 (which is the iframes source). I don't want to reload the page at all. I simply want to be able to click a button to update summary info... that's it.
 
exactly, that cannot be done as iframes will refresh if the main window (which holds it) refreshes. therefore i suggested the session approach...

Known is handfull, Unknown is worldfull
 
I see....I was afraid of that... Thanks for you help...

-Kevin
 
no probs, bu again like i said, u can use sessions to overcome this...

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top