开发者

ASP.NET jQuery from Postback issue

I am very new to jQuery ...

I am implementing jQuery UI in my asp.net page.

The feature that I am implementing is Modal Popup Dialog (its a small form actually)

The control/page on which popup is implemented is also a form.

ideally the situation would be: the users fills the two text boxes on the page, then clicks on a button that pops up a small modal form that has 1 text box, users fills that and presses a button on the modal popup, that button do its job, and closes the popup, the user then clicks save on the main page.

the above scenario is not quite happening ...

the page has two divs

the first div is the div1 that will popup (the div that contains 1 txtbox and a button) the second div is the div2 (the div that contains two txtboxes and a save button)

the contents of both divs are encapsulated in their respective UpdatePanels (both divs them selves are outside any updatepanel)

if the div1 (popup div)'s content is not encapsulted in a tag, the OnClick event on the button inside popup doesn't fire. (it just closes the popup, because i have written the close script above in the script section)

if i encapsulate every thing in div1 within the tags, the OnClick event fires, the popup closes (not sure because of the event firing or my close sc开发者_如何学Goript), BUT the 2 text boxes in the div2, are now empty ... (and after further investigating i found, that the textbox in the popup (div1) also submitted an empty string when OnClick event happened)

I need to fix this, i need the values to be there when popup closes, and i definitely want to call the OnClick event attached to the button in the popup ...

ONE BAD SOLUTION: if i encapsulate ONLY the elements that cause postback with the UpdatePanel (the buttons in div1 and div2) then the event also fires, and the values remain there when the popup closes ... the reason why its bad, because i will have many postback elements on page, like dropdowns etc, and just encapsulating the elements with UpdatePanel, will may be end up with 5-6 UpdatePanels on the page ....


Just use your two divs to hold the data while the user fills in the data. On form submit retrive all the data fields in code behind. Dont complicate things unnecessarily and please provide code in future for better understanding.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜