ASP.NET: Forcing postback (on parent window)

liunx

Guest
I have a form that opens up an aspx page and does some updates etc. I placed a button which has an attribute to close the window, but i want to extend it so it also reloads the parent window. I did this in ASP easily by just calling a form submit, but that isn't quite possible in ASP.NET

how do i force the parent page to postback? I saw a few solutions involving using the __doPostBack method and handling the event on the serverside, such as this one: <!-- m --><a class="postlink" href="http://www.eggheadcafe.com/PrintSearchContent.asp?LINKID=668">http://www.eggheadcafe.com/PrintSearchC ... LINKID=668</a><!-- m --> which uses the method as a bridge... but it's somewhat beyond me.

i don't need to pass information from the child, all the updating is done in the child. All i want to do is call a postback on the parent, then close the child.Haven't got seriously into .NET yet but from my quick training class I'd have to say that a true ".NET Developer" would tell you that the main design of the .NET structure would be to have all your code stuffed into one page with a bunch of code behinds and if you need an interface to be update, you should use a User Control that can be tied into different pages rather than having your parent window of a frameset / iframe combo.

I know, I know, "thanks a TON putts" :Pwell, i am using code-behinds at least! though that is completely unrelated

i don't get how you would use user controls to make popup windows? i don't think .NET has faciliated that ... you still need to use javascript, and as a result i still need to find a line of communication between the child and parent windows.

but yes, you are my saviour ryan ;)Originally posted by eRad
I did this in ASP easily by just calling a form submit, but that isn't quite possible in ASP.NET


I bet it is, just might not be exact. Have your tried?

I'm having trouble understanding what exactly you are trying to accomplish. Is this a new window or is this a child window in a frameset?i tried the form submit once and it didn't seem to do anything... i guess i'll try again on monday

anyway here is what's going on:

window A shows some records in a datagrid. it has a link beside each record which passes the record ID as part of a querystring.

window A's link opens window B in a child window, which executes some SQL on that given ID. it also has a close button (added an onclick attribute of self.close() to an asp button)

now that's all fine and good. but once the child window has updated the db and closed, i want window A to refresh its datagrid to show the updated record.

this involves just adding some more javascript to the Close button to do other stuff to its parent. I can force the window to reload, but then it does that popup dialog asking you if you want to resubmit the variables - i don't want users to have to do that. I just want the datagrid to postback.Originally posted by rdove
I bet it is, just might not be exact. Have your tried?

I'm having trouble understanding what exactly you are trying to accomplish. Is this a new window or is this a child window in a frameset?

I think eRad's getting to the fact that .NET doesn't support multiple forms where he could just have a button (like a cancel or something) that has a form associated with it that targets the parent and lets it know what's going on (such as processing stopping in the case of a cancel button).

eRad - User Controls are .NET's tools for supplying things like navigation bars and what not. They're meant to just be the visual display that have the ability to talk to the postback, etc. to do stuff dynamically.

I'm sure M$'s site could explain them better than I.User Controls are used alot for navigation and such but in reality they are more like a stand alone component. But with the exception is that for every version of the component it must be shipped inside the bin directory if not in the same namespace and dll as App. If its a dll with a strong name component then you can install the object inside the GAC then call it from any app without an issue, one place to fix errors, multiple copies with different versions can also be installed in the directory if a true component.

User Controls have the plus of Design time, Components do not. There are pluses to each and faults also. But the right one is choosing the need. Do you need to create a control that is used on multiple websites multiple machines with the need to upgrade? No then go with User Controls. If so then go with components.Originally posted by eRad
i tried the form submit once and it didn't seem to do anything... i guess i'll try again on monday

anyway here is what's going on:

window A shows some records in a datagrid. it has a link beside each record which passes the record ID as part of a querystring.

window A's link opens window B in a child window, which executes some SQL on that given ID. it also has a close button (added an onclick attribute of self.close() to an asp button)

now that's all fine and good. but once the child window has updated the db and closed, i want window A to refresh its datagrid to show the updated record.

this involves just adding some more javascript to the Close button to do other stuff to its parent. I can force the window to reload, but then it does that popup dialog asking you if you want to resubmit the variables - i don't want users to have to do that. I just want the datagrid to postback.

Thats why I use custom scrolling on DataGrid and Lists. You can call the parameters in the URL, if so then
<script>
opener.location.href = <!-- m --><a class="postlink" href="http://www.htmlforums.com/archive/index.php/opener.location.href;">http://www.htmlforums.com/archive/index ... tion.href;</a><!-- m -->
self.close();
</script>thanks a ton afterburn, that works perfectly!

and to think how retardedly complex the postback solutions were!
 
Back
Top