Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi friends...
i am using showing images in datalist. i have problem in opening Ajax modal popup extender from code behind file.
i have written the following code.

C#
DataListItem row = (DataListItem)(((ImageButton)e.CommandSource).NamingContainer);
           ImageButton ImageButton = (ImageButton)DataList1.Items[row.ItemIndex].FindControl("Image1") as ImageButton;
           Label lblnum = (Label)DataList1.Items[row.ItemIndex].FindControl("lblnum") as Label;
           AjaxControlToolkit.ModalPopupExtender modpopup = new AjaxControlToolkit.ModalPopupExtender();
           modpopup.TargetControlID = "ImageButton";
           modpopup.PopupControlID = "pnlDirImages";
           modpopup.BackgroundCssClass = "modalBackground";
           modpopup.CancelControlID = "btnclose";
           conn.Open();
           string strquery = "some query";
           SqlDataAdapter da = new SqlDataAdapter(strquery, conn);
           da.Fill(objds);
           conn.Close();
           if (objds.Tables[0].Rows.Count > 0)
           {
               dlImages.DataSource = objds.Tables[0];
               dlImages.DataBind();
               pnlDirImages.Visible = true;
               modpopup.Show();
           }
           else
           {
               pnlDirImages.Visible = false;

           }



please respond fast plaese
thank u
Posted
Updated 17-Oct-11 20:21pm
v2

i have found this solution,,.
no need of assigning any value from code behind.u just handle it from design page and target control to some dummy button, then u fill grid button function.
u just show the modal popup.
it will solve this problem..
if u want code..please respond..i ll explain with code
 
Share this answer
 
v2
 
Share this answer
 
Comments
harry.devu87 18-Oct-11 2:32am    
thanks for solution...but i m using datalist..i have to execute code before opening popup

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900