Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何给出基于ID的图像动态路径,以及如何在html中给出路径?_C#_Html_Asp.net - Fatal编程技术网

C# 如何给出基于ID的图像动态路径,以及如何在html中给出路径?

C# 如何给出基于ID的图像动态路径,以及如何在html中给出路径?,c#,html,asp.net,C#,Html,Asp.net,我有一个中继器,在它的事件中,我得到了如下图像: string hotelid = ((Label)e.Item.FindControl("lblhotelid")).Text.ToString(); dr = d.FetchDataReader("SELECT HotelName,CityId,SrNo,StateId,shortdescription FROM HotelMaster WHERE srno ='" + hotelid + "'");

我有一个中继器,在它的事件中,我得到了如下图像:

string hotelid = ((Label)e.Item.FindControl("lblhotelid")).Text.ToString();

        dr = d.FetchDataReader("SELECT   HotelName,CityId,SrNo,StateId,shortdescription FROM HotelMaster  WHERE srno ='" + hotelid + "'");

        if (dr.Read())
        {

            string stateid, cityid;
            stateid = dr["stateid"].ToString();
            cityid = dr["Cityid"].ToString();

            Image img = (Image)e.Item.FindControl("imghotel");

            img.ImageUrl = "http://bindassholidays.info/Photos/HotelPhotos" + "/" + stateid + "/" + cityid + "/" + hotelid + "/" + hotelid + ".jpg";

        }
        dr.Dispose();
        dr.Close();
现在我想在html中使用此路径,但它不起作用

我想通过给出此路径弹出图像,如何在代码隐藏中使用此路径(代替#)




能否请您提供设计相关的代码部分OK,请参阅更新问题
<asp:repeater ID="rephotelbind" runat="server" onitemdatabound="rephotelbind_ItemDataBound"> 
<ItemTemplate>
 <div class="related_project">
                                            <div class="overlay_a related_img">
                                                <div class="overlay_wrapper">
                                                <asp:Image ID="imghotel" runat="server" Height="175" Width="175"></asp:Image>

                                                    <div class="overlay">
                                                        <a class="overlay_img" href="#" rel="lightbox" title=""></a>
                                                        <a class="overlay_project" href=""></a>

                                                    </div>
                                                </div>
                                            </div>
                                            <h4><a href='<%# "hotelview_more.aspx?hid="+Mainclass.Encrypt(Eval("SrNo").ToString()) %>'> <asp:Label Visible ="false" ID="lblhotelid" runat="server" Text='<%#Eval("SrNo") %>'></asp:Label>
                                            <asp:Label ID="lblhotelname" runat="server" Text='<%# Eval("hotelname")%>'></asp:Label></a></h4>
                                            <p><asp:Label ID="lblhotelinfo" runat="server" CssClass="ShortDesc" Text='<%#Eval("shortdescription") %>' height="60px" width="185px" Style="word-break: break-all; word-wrap: break-word;"> </asp:Label>

                                            ,<a href='<%# "hotelview_more.aspx?hid="+Mainclass.Encrypt(Eval("SrNo").ToString()) %>'> [...]</a>


                                        </div>

 </ItemTemplate>
 </asp:repeater>