Returning parameters from new window - asp.net

What I want is to open a new popup from the server side, this pop up has a form with three fields, and then return this three fields to the parent page. But I want this fields in the server side, in the VB.NET code. Is this possible?

Is a modal popup window acceptable? If so, you could put the variables in an update panel, and use the server side event of the button that causes a postback on the modal to force the the update panel to update.

Create a form to show as popup
Display it
Perform a POST request onto the parent form to pass the values
or
save input into Session vaariable and read it on popup close

Related

How do I automatically refresh a gridview in asp.net webform after a button click while the onclick method is still processing on the server side?

I have a two column asp.net webform. The form is the on the left side and the gridview is on the right side. When a user clicks on a button, there is a method on the server side that will process a list of items. I want to show the results in the gridview on the right as each item in the list is processed. I also want to disable a bunch of controls on my page after the button click and enable them once the entire list is processed.
Thanks!
make use of client side/javascript.
e.g. run a client side loop on button click, take the first item from gridview process it, update the second gridview and repeat.

Accessing server controls from different pages

I have a GridView on PageA, I wish to be able to call the DataBind() method of the GridView from PageB?
Basically PageB is a form which will be contained in a pop up control, when the user fills in the fields of the form on PageB and submits it I will close the pop up control, then I want to refresh the GridView on the parent page (PageA), how would I go about doing that?
Write a javascript function on Page A like RefreshGrid, you can write various ways to refresh grid from this javascript function e.g.
1) put your grid inside an update panel and create a trigger button control on that update panel , call this trigger control's click event in javascript , this will partial post back the page and refresh the update panel. There are other ways too..
2) From popup on popup close button, write following line
window.opener.RefreshGrid(); window.close();
Thats it.
If you want to pass any parameter you can pass through as argument to RefreshGrid function.
Still there are many ways , this is the one I use.

User Control is not posting its form values

I have a user control I am adding dynamically.
It has a link button and a text area on it. The containing div is hidden via style sheet (client side), and I use some jquery to pop it up in a modal.
It is getting added in the init and the button click event is firing on the server.
BUT the textareas value is not being set. On further inspection the field value is not even being sent in the form POST data.
Any ideas why the value is not being sent. The rest of the form values are being sent with no problems.
Make sure the control is actually being added to a form control. Your link button will still post back even if it's outside the form as it's a javascript call, but there won't be any content from your server controls in postdata.

Accessing a Dropdown from child window

I have on server control(dropdown) and One button.user can select some values in dropdown and click button.I have to show a pop-up.In this pop-up I have show data based upon value selected in dropdown.How to access a dropdown in codebehind of pop-up screen.I am loading a .aspx in pop-up using javascript.
Why not just pass the selected value of the dropdownlist as a querystring parameter to the popup page?
That's the way i'd do it.
If you dont want to do it that way, you can access the parent window by using window.opener.document.
So something like:
window.opener.document.getElementById('yourDDLId').value;
Still i'd recommend passing through as querystring param. Simple and easy.

How can controls (buttons) be set in a ModalPopup Extender panel that do NOT close the panel?

Here's the situation.
When a user is editing a given piece of data, they're allowed to add messages/comments. These are stored as child records in a SQL database. Clicking on the Add Message button brings up a panel (pnlMessage) courtesy of the AJAX ModalPopup Extender. This takes some input and, when the "Send Message" button in the panel is clicked (I learned the hard way to NOT make that the 'OkButton' property), the message is stored in the database and an email is sent to the intended recipients. No problem there.
However, I need to be able to allow the user to add new email addresses (so long as they are registered in our database). I have another ModalPopup / panel combo (pnlSearch) that's tied to a button on the previous panel (pnlMessage).
The user is supposed to be able to add an email or click on a search button to populate a list to choose from.
The pop-up panel (pnlSearch) comes up just fine, but clicking the "Lookup" button (which instigates the search and returns a collection of records that the user is supposed to pick from) closes the panel.
Previously, I ran into the problem of having the Button.Click event never firing when I put the Button into the "OkControlID" property (the CancelControlID works fine since I don't want to do anything). Removing the "OkControlID=Button" line allowed it to work perfectly with the Button.Click event firing as expected.
So now I have the Search panel with a button for "OK" and a button for "Search" - but the panel should stay up and visible after the Search.Click does it's thing. Am I missing some property that basically says "don't close the panel when this button is clicked"? Of course, if I bring up the panel again in the same session, the results from the previous effort are there (the search results).
I'm trying to avoid having to go to javascript as there isn't much, if any, of that experience available to support this.
Help!
Thanks in advance.
You can put the Search panel and the Search button inside of an UpdatePanel. Anything inside of the UpdatePanel will be able to post back without closing the popup. Be sure not to put the buttton that is supposed to close the popup inside of the UpdatePanel.

Resources