i have a grid view on a page and i have webusercontrol which contains the registration for and this usercontrol open in a popup and when i click finish submit of registration this will add the new entry in database. but my grid still show previos records untill i refresh the page . so how can i rebind the grid on click of Submit button of user control?
thanks
You need to refresh parent page on popup window closing.
This link would be help. Closing-child-pop-up-and-refreshing-parent-page
Or you can check the javascript code below.
function refreshParent() {
window.opener.location.href = window.opener.location.href;
if (window.opener.progressWindow)
{
window.opener.progressWindow.close()
}
window.close();
}
Related
When triggering a fancybox click event with RegisterStartupScript after postback, the source element does not get recreated when closing the fancybox.
The user opens up the fancybox with a form and submit button as content.
The user is able to open and close the fancybox multiple times as expected if not posting the form.
When the user hits the submit button a fancybox trigger click scripts gets injected with RegisterStartupScript in order to show the form with a confirmation message directly after the form has successfully been sent. This works as expected.
If the user then clicks the close button of the fancybox the source element is not recreated to it's original position in the DOM. So if the user tries to open the fancybox again the content is missing and the fancybox breaks.
I expect the source element to be recreated when closing the fancybox.
Example of code:
// Form submit button
FormSubmit.Command += new CommandEventHandler(submit_command);
// Click event
protected void submit_command(object sender, CommandEventArgs e)
{
// Do stuff
// Trigger click event on fancybox in order to reopen the form immediately after postback
Page page = HttpContext.Current.Handler as Page;
ScriptManager.RegisterStartupScript(page, page.GetType(), "reopen", "$('#OpenFancy').fancybox().trigger('click');", true);
}
So the fancybox is reopened as expected but when I close the fancybox and try to open it again the fancybox breaks because the source element has not been copied back to the default position in the DOM.
I have just implemented a modal popup on my site to capture email addresses. Once the user clicks the submit button the form is submitted. I am calling the modal again after a page.ispostback which works fine. However, I only want it to display after a user clicks that particular submit button. As this is on a master page, if someone goes to my 'Contact Us' page and submits a question on postback the modal reappears which I don't want. I literally only want it to appear after a postback from the submit form on the modal.
Any ideas how I can get around this?
Thanks
Rob
To display the modal only after the user clicks the submit button, you should put the modal's display logic only in this button's submit event.
Take the logic out of the Page_Load's IsPostBack, and put it at the end of this button's OnClick event
protected void Button_Click(object sender, EventArgs e)
{
// Do some work...
// Show modal
}
I have opened a dialog box using jQuery. In dialog box I have added to code to close when close button is clicked. In this function i have used window.close(). In some cases it refreshes the parent page but i do not want to refresh the parent/caller page. How can I restrict parent page to refresh.
if (condition)
{
window.close();
return false;
}
Thanks.
event.stopPropagation() of jquery Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event.Is this what you were looking for?.Hope that helps.
I am currently working on an ASP.net c# project. I have an aspx page where I have a form taking user input and a datagrid. When the user clicks on a link inside the datagrid it displays a modal popup extender with dynamic data. This is working fine.
What I want to be able to do is when the modal popup extender is opened it has a form that can also take user input. However, I am having a problem that when I try to enter data into the form in the modal popup extender and i press the submit button it is first checking the form on the proper page, not in the modal popup extender, which is preventing the form on the modal popup extender from being submitted.
How can I get around this issue?
I assume it's firing validators on the form on the main page and not allowing you to submit the modal form?
If that's the case you can change the form on your main page to use a different ValidationGroup so it doesn't fire when you submit the modal form.
I have a datalist in my aspx page. In the datalist, there are images displayed. When I click on an image, a bigger version of the image appears in a popup, and in this popup there is a button. On that button, I want to react to a click even without postback. What I'm doing now is not working every time. I am using go for the item_created event and __dopostback(btn.id,"onClick").
The item_created event fires when I click on the ok button on the div that displays the image.
If you mean that ItemCreated event is firing every time post back is occurring. Please do your databinding only first time when page loads. You can use IsPostBack property to check if it is a postback or fresh loading of page.
Page_Load(....){
if(!IsPostBack){
LoadData();
}
}
If you do not want to use postback on button click, please use ajax and page methods. You can get more information here: Using jQuery AJAX to directly call page methods.