I have a modal with JQuery UI tabs inside. There is a ASP.NET checkbox list server control in one of the tabs. I am facing a weird issue that if I set toTop:true in JQModal parameters
when I run a server side foreach on the checkbox list it always returns
false on all items. Even though if they are selected/checked by user on
screen ._.
foreach (ListItem li in cbItems.Items)
{
if (li.Selected) // <= Always false ???
{
DataRow dr = dt.NewRow();
dr["ID"] = Convert.ToInt32(li.Value.ToString());
dr["ITEMNAME"] = li.Text.ToString();
dt.Rows.Add(dr);
}
}
Removing toTop from the JQModal parameters solves the problem but creates another problem that in IE7 my JQ modal window is behind the overlay of modal, which might be due to the container div having CSS position:relative. Any clue guys ?
Edit:
The checkbox list is inside an updatepanel. Using $('body').append($('#testdiv')) ; fixes the overlay problem but looses the server side events. I found a similar situation here http://forum.jquery.com/topic/jqmodal-and-asp-net-updatepanel-in-master-page-do-not-work-in-ie7-in-the-content-pages-found-the-solution
but dont understand the solution. I removed the tabs , so the problem is with JQ Modal and updatepanel only.
for a checklist to postback it must be a descendant of the <form runat=server"> when the postback occurs. when the modal appends its div to body, the checklist is no longer a descendant, and not included in the partial postback.
you have a couple options.
1) create a hidden field in the form, and set the checked values there.
2) move the <form runat=server> to be the first child of body, and append the dialog to $('form') instead of $('body').
asp_crazy_gu...
Member
481 Points
383 Posts
JQModal, JQuery UI tabs & ASP.net checkboxlist
Nov 10, 2010 05:45 AM|LINK
I have a modal with JQuery UI tabs inside. There is a ASP.NET checkbox list server control in one of the tabs. I am facing a weird issue that if I set toTop:true in JQModal parameters
$(document).ready(function() { $('#testDiv').jqm({toTop: true}); });when I run a server side foreach on the checkbox list it always returns false on all items. Even though if they are selected/checked by user on screen ._.
foreach (ListItem li in cbItems.Items) { if (li.Selected) // <= Always false ??? { DataRow dr = dt.NewRow(); dr["ID"] = Convert.ToInt32(li.Value.ToString()); dr["ITEMNAME"] = li.Text.ToString(); dt.Rows.Add(dr); } }Removing toTop from the JQModal parameters solves the problem but creates another problem that in IE7 my JQ modal window is behind the overlay of modal, which might be due to the container div having CSS position:relative. Any clue guys ?
Edit:
The checkbox list is inside an updatepanel. Using $('body').append($('#testdiv')) ; fixes the overlay problem but looses the server side events. I found a similar situation here http://forum.jquery.com/topic/jqmodal-and-asp-net-updatepanel-in-master-page-do-not-work-in-ie7-in-the-content-pages-found-the-solution but dont understand the solution. I removed the tabs , so the problem is with JQ Modal and updatepanel only.
asp.net 2.0 JQuery & Asp.net
Mike.
bruce (sqlwo...
All-Star
37616 Points
5574 Posts
Re: JQModal, JQuery UI tabs & ASP.net checkboxlist
Nov 10, 2010 03:30 PM|LINK
for a checklist to postback it must be a descendant of the <form runat=server"> when the postback occurs. when the modal appends its div to body, the checklist is no longer a descendant, and not included in the partial postback.
you have a couple options.
1) create a hidden field in the form, and set the checked values there.
2) move the <form runat=server> to be the first child of body, and append the dialog to $('form') instead of $('body').