Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Need to show image on popup from gridveiw's selected.

$
0
0

I am not able to see image from selected row in updatepanel2 here is my code.

Aspx code

<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head id="Head1" runat="server"><title>Modal Popup using Bootstrap</title><link href="../bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css" /><script src="http://code.jquery.com/jquery-1.9.1.min.js"></script><script src="../bootstrap/js/bootstrap.js" type="text/javascript"></script></head><body><form id="form1" runat="server"><div><asp:ScriptManager ID="ScriptManager2" runat="server" /><asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click2" /><asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:GridView ID="GridView1" runat="server"
                        Width="94px"  HorizontalAlign="Center"
                        OnRowCommand="GridView1_RowCommand"
                        AutoGenerateColumns="false"   AllowPaging="false"
                                CssClass="table table-hover table-striped" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"><Columns><asp:TemplateField HeaderText=""><ItemTemplate><asp:button ID="Button2" runat="server" Text="View"  CommandName="select" /></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Images"><ItemTemplate><asp:Image ID="Image1" runat="server" Height="80" ImageUrl='<%# Eval("image") %>' Width="80" /></ItemTemplate></asp:TemplateField></Columns></asp:GridView></div></ContentTemplate></asp:UpdatePanel><asp:UpdateProgress ID="UpdateProgress1" runat="server"><ProgressTemplate><img src="" alt="Loading.. Please wait!"/></ProgressTemplate></asp:UpdateProgress><div id="currentdetail" class="modal hide fade"
               tabindex=-1 role="dialog" aria-labelledby="myModalLabel"
               aria-hidden="true"><div class="modal-header"><button type="button" class="close" data-dismiss="modal"
                  aria-hidden="true">×</button><h3 id="myModalLabel">Detailed View</h3></div><div class="modal-body"><asp:UpdatePanel ID="UpdatePanel2" runat="server"><ContentTemplate><asp:Image ID="Image2" runat="server" /></ContentTemplate><Triggers><asp:AsyncPostBackTrigger ControlID="GridView1"  EventName="RowCommand" /> </Triggers></asp:UpdatePanel><div class="modal-footer"><button class="btn btn-info" data-dismiss="modal"
                            aria-hidden="true">Close</button></div></div></div></div></form></body></html>

C# code

   protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            GridViewRow row =GridView1.SelectedRow;



            string url = row.Cells[1].Text;
           Image2.ImageUrl = url;
           
               System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append(@"<script type='text/javascript'>");
                sb.Append("$('#currentdetail').modal('show');");
                sb.Append(@"</script>");
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                           "ModalScript", sb.ToString(), false);


        }

I want to see image after clicking on view button.

 string url = row.Cells[1].Text;
           Image2.ImageUrl = url;

This has fully qualified url.

Please help. Thanks



Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>