new
LiteralControl("<div><h2><strong>Add new Asset</strong></h2></div>"));
np.Controls.Add(new
LiteralControl("<div style=\"margin:10px;line-height:150%;\">"));
np.Controls.Add(
new
LiteralControl("Asset title :"));
np.Controls.Add(new
LiteralControl("<div style=\"margin:8px 0px;\">"));
So unfortunately, that did not quiet fix my problem. I feel like the problem might be with the modal popup extender. Here is what happens:
When I dynamically generate those links and have a list of them only the first works. The second link does not open a modal window, BUT when I go back to click on the first link that works both of the windows open up and it is weird, because they are on
top of each other. Anybody had anything like this happen?
lineika
Member
4 Points
7 Posts
accordion and modal popup extender
May 29, 2007 08:29 AM|LINK
Hello guys,
I am new to atlas and ajax. Any help would be greatly appreciated.
I dynamically create accordion panes, panel and modal popup extenders.
First I tried to declare all the panels that will be targets to modalpopuextenders, and modal popupextenders outside of accordion pane.
The linkbuttons that call modalpopup are inside accordion panes. I am getting errors like link button with the following name could not be found.
I also tried putting the panels and modalpopup extenders into the panes but that caused the accordion not to display properly. What should I do?
Thanks alot
Here is my code:
the aspx page looks like this: <form id="form1" runat="server"> <asp:ScriptManager runat="server" ID="scriptManager" EnablePartialRendering="true"> <Services> <asp:ServiceReference path="assetService.asmx" /> </Services> </asp:ScriptManager> <div> <TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0"> <TR ALIGN="LEFT" VALIGN="TOP"> <TD ALIGN="LEFT" VALIGN="TOP"> <asp:UpdatePanel runat=Server ID="assetListPanel" UpdateMode="Always"> <ContentTemplate> <ajaxToolkit:Accordion ID="newAccordion" runat="server" EnableViewState=true SelectedIndex="0" HeaderCssClass="accordionHeader" ContentCssClass="accordionContent" FadeTransitions="false" FramesPerSecond="60" TransitionDuration="75" AutoSize="Limit" RequireOpenedPane="false" SuppressHeaderPostbacks="true" Width="250" Height="525">
</ajaxToolkit:Accordion>codebehind looks like this:
void Page_Load(Object sender, EventArgs E){
testLbl.Text = DateTime.Now.ToString(); // Load connections and strings connectionString = ConfigurationManager.AppSettings["db_connection_string"];pSpon = new ProcSponsorship(connectionString);dtCategories = pSpon.GetAssetCategories();
LoadNewAssetPane();
}
/* void Page_Load(Object sender, EventArgs E){
}*/
void LoadNewAssetPane(){
AccordionPane ap;
foreach (DataRow dRow in dtCategories.Rows){
int curCat = (int)dRow["AssetItemCategoryId"];dtAssetItems = pSpon.GetAssetItems(curCat);
string CatDescr = dtAssetItems.Rows[0]["CatDescr"].ToString(); string CatDescrLong = dtAssetItems.Rows[0]["CatLongDescr"].ToString(); ap = new AccordionPane();ap.ID =
"AssetItemCat_" + curCat; ap.HeaderContainer.Controls.Add(new LiteralControl("<span onmouseover=\"return escape('" + CatDescrLong + "')\"><a class=accordionLink>" + CatDescr + "</a></span>"));for (int i = 0; i < dtAssetItems.Rows.Count; i++){
//ap.ContentContainer.Controls.Add(new LiteralControl("<span onmouseover=\"return escape('" + dtAssetItems.Rows[i]["LongDescr"] + "')\"><a href=http://forums.asp.net/AddPost.aspx?ForumID=15# class=accordionLink>" + dtAssetItems.Rows[i]["DisplayDescr"] + "</a></span><BR>"));
LinkButton lb = new LinkButton();lb.ID =
"AssetItemId_" + dtAssetItems.Rows[i]["AssetItemId"]; lb.Text = (dtAssetItems.Rows[i]["DisplayDescr"]).ToString() + "<br/>";ap.ContentContainer.Controls.Add(lb);
Panel np = new Panel();np.ID =
"AssetItemId_Panel_" + dtAssetItems.Rows[i]["AssetItemId"]; np.Style.Value = "display: none;"; //np.Style = "display: none"; np.CssClass = "add_task_panel";np.Controls.Add(
new LiteralControl("<div><h2><strong>Add new Asset</strong></h2></div>")); np.Controls.Add(new LiteralControl("<div style=\"margin:10px;line-height:150%;\">"));np.Controls.Add(
new LiteralControl("Asset title :")); np.Controls.Add(new LiteralControl("<div style=\"margin:8px 0px;\">"));
TextBox tb1 = new TextBox();tb1.ID =
"AssetItemId_Panel_TextBox" + dtAssetItems.Rows[i]["AssetItemId"]; tb1.TextMode = TextBoxMode.MultiLine;tb1.Rows = 2;
np.Controls.Add(tb1);
np.Controls.Add(new LiteralControl("<div>")); Button bt1 = new Button(); bt1.ID = "AssetItemId_Panel_ButtonSave" + dtAssetItems.Rows[i]["AssetItemId"];bt1.Text = "Save";np.Controls.Add(bt1);
Button bt2 = new Button(); bt2.ID = "AssetItemId_Panel_ButtonCancel" + dtAssetItems.Rows[i]["AssetItemId"];bt2.Text = "Cancel";np.Controls.Add(bt2);
np.Controls.Add(new LiteralControl("<div>"));
ModalPopupExtender modal = new ModalPopupExtender(); modal.ID = "AssetItemId_Modal" + dtAssetItems.Rows[i]["AssetItemId"];modal.OnOkScript =
"AddAsset();"; modal.CancelControlID = "AssetItemId_Panel_ButtonCancel" + dtAssetItems.Rows[i]["AssetItemId"];modal.OkControlID =
"AssetItemId_Panel_ButtonSave" + dtAssetItems.Rows[i]["AssetItemId"]; modal.BackgroundCssClass = "modal_bg";
string s = "AssetItemId_" + dtAssetItems.Rows[i]["AssetItemId"]; //LinkButton b = (LinkButton)(ap.ContentContainer.Controls[2 + i]);
modal.TargetControlID = "AssetItemId_" + dtAssetItems.Rows[i]["AssetItemId"];modal.PopupControlID = "AssetItemId_Panel_" + dtAssetItems.Rows[i]["AssetItemId"];
//ap.ContentContainer.Controls.Add(modal);assetListPanel.ContentTemplateContainer.Controls.Add(np);
//ap.ContentContainer.Controls.Add(modal);assetListPanel.ContentTemplateContainer.Controls.Add(modal);
}
newAccordion.Panes.Add(ap);
}
}
Jin-Yu Yin -...
All-Star
21280 Points
1824 Posts
Re: accordion and modal popup extender
Jun 04, 2007 09:21 AM|LINK
Hi,lineika
Your can fix your problem like this:
Now you don't get errors like link button with the following name could not be found. :)
Hope this helps,
Let me know if you need more info.
Jin-Yu Yin
Microsoft Online Community Support
lineika
Member
4 Points
7 Posts
Re: accordion and modal popup extender
Jun 06, 2007 06:03 PM|LINK
Jin-Yu Yin,
Thanks a lot for the response. This looks like it will work. I will try it immediately.
Thanks again
Alex
lineika
Member
4 Points
7 Posts
Re: accordion and modal popup extender
Jun 08, 2007 06:46 PM|LINK
So unfortunately, that did not quiet fix my problem. I feel like the problem might be with the modal popup extender. Here is what happens:
When I dynamically generate those links and have a list of them only the first works. The second link does not open a modal window, BUT when I go back to click on the first link that works both of the windows open up and it is weird, because they are on top of each other. Anybody had anything like this happen?
Thanks
Alex
chetan.sarod...
All-Star
65709 Points
11133 Posts
Re: accordion and modal popup extender
Jun 09, 2007 05:25 AM|LINK
Thanks [:)]
Senior Software Engineer,
Approva Systems Pvt Ltd, Pune, India.
lineika
Member
4 Points
7 Posts
Re: accordion and modal popup extender
Jul 16, 2007 04:29 PM|LINK
Hello guys,
Thank you for the suggestion, it finally worked. The only thing is, it does not work in Firefox anybody knows why?
Thanks
Alex
PrasanaS
Member
8 Points
17 Posts
Re: accordion and modal popup extender
Feb 26, 2013 06:47 AM|LINK
plz i need your help can u send ur correct code i m trying this from past one week to keep a imagebutton popup inside header of accordian
my mail id prasana.1412@gmail.com