Passing information between windows ASP.net - asp.net

Here is the problem: I have a HTML page called test.html and an ASPX page called getitem.aspx.
Now what I want to do is, upon clicking a button on test.html, I want the getitem.aspx page to open in a new dialog and allow entry on a text box. After clicking the OK button on getitem.aspx, this dialog should close and the entry should be passed back to the html page.
The issue is that the getitem.aspx has several buttons that trigger postback - but I only want the item from the text box to be sent back to test.html upon clicking of the OK button and not any other buttons.
How could I implement this?

You should use javascript to do that
first you need to use window.open() method to open the popup
after you have closed the page you should use window.opener for accessing to the closed windows and use javascript method like (getElementById) to find the element on that window and read it's value and then use !!
Hope it helps

Related

Button clicks are ignored based on URL

I've one strange issue.I have one asp.net button on webpage integrate with masterpage.when I call the page using the url something like that http://www.mywebsite.com from address bar and click on button nothing is happened,it stays on same url. means it ignore the button click event.
Now if I call the page using url http://www.mywebsite.com/default.aspx and click on button then it capture the button click even and execute the code inside that button click
how can I solve this issue ?

Can I have a modal dialog from asp.net gridview edit click?

I am wondering if it is possible to have a modal dialog (like JQuery) by clicking Edit button on a asp.net built in gridview control. If yes, can anymore point me out the brief process of how it could be done. Please see the picture below for clarification.
Thanks.
I see few ways to do that:
Using OnEditCommand property (assuming you are using <asp:EditCommandColumn to draw that edit link):
You can show popup using serverside handler (for instance, popup included into ajaxcontroltoolkit.dll which allows to show popup from serverside easily on page reload)
Another option:
Make your own column with edit link for each item. It can have OnClientClick handler which will open jQuery popup directly on client (but you will need to get row info for current line from server somehow: with your own ajax call or, suppose it will be better, using webservice with webmethod)
Second option could be modified: instead of creating own column, you may add click even handler with that same jquery on default edit link with return false, so it will prevent form submition.
I never did something like this personally and even newer saw implementations of such thing, but I would select some option from those listed above. I do not think that there is some really simply, built in way of doing that.
UPD:
Here is an example of opening popup with own edit button and modalpopupextender from ajax control toolkit (similar like in my first option except that they are using own edit button, which I think could be easily replaced by default one and OnEditCommand even handler) :
http://www.c-sharpcorner.com/UploadFile/krishnasarala/edit-gridview-row-with-model-popup-extender-in-Asp-Net-ajax/

asp.net form postback or not depending on button clicked

I need an idea for a situation like this:
There is this aspx form which contains some buttons like "save", "import", and print;
on the last one clicked a window should appear providing the user with a print-friendly version. what i need is the form not to cause postback and reload in this case, while normally postback-ing when the other buttons are clicked.
Or use hyperlink with target="_blank" to open up the document in a new window.
If you like to use the button, you have to use the window.open syntax to open a new page: http://www.javascript-coder.com/window-popup/javascript-window-open.phtml
HTH.

Page_Load after Modal Popup

I have a page with a user control which gets some data updated via a modal popup. Upon clicking "ok" on the modal popup - the new data is being written to the database - but the base page doesnt "reload" to show the updated data. How do I get that to happen?
1) Don't set the OKControlID property on the ModalPopupExtender.
2) In your Page_Load, set OkButton.OnClientClick = string.Format("$find('{0}').hide();", modalPopupExtender1.ClientID);
Explanation:
Setting the OkControlID stops the button from posting back. Instead, manually use javascript to hide the extender, which will allow the button to post the form.
You'll either have to update that control using ajax, or you could just do a Response.Redirect(assuming your modal is .net, or document.location if js) back to your page after your data has been updated.
Make sure the "Ok" button in your modal popup is causing a postback. If you want it to be ajax-enabled, make sure to put it inside of an update panel.

Prevent Postback in array of linkbutton is created at dynamically

i have created Array of Linkbutton
and when user click on link button it will create an array of Radio Buttons
but it requires Postback all time so page load takes more time...
what is solution of it??
Use asp.net Ajax update panel.
Put link buttons and panel/view (or what ever control you are using ) update panel.
I am not sure if I am following a 100% but if you don't want to do a post back then your going to need to write some javascript(or use a framework like jquery) to generate radio buttons when the user clicks the link button(plus you probably don't want to use a link button then as it will try to always cause a postback or you will need to stop the post back from happening).

Resources