C# 是否将图像重定向到aspx中的其他表单?
这是我的aspx代码C# 是否将图像重定向到aspx中的其他表单?,c#,asp.net,C#,Asp.net,这是我的aspx代码 <asp:DataList ID="DataList1" runat="server" RepeatColumns="3" RepeatDirection="Horizontal" Width="88%" Height="100px"> <ItemTemplate> <table width="0" border="0" cellpadding="0" cellspacing="1">
<asp:DataList ID="DataList1" runat="server" RepeatColumns="3" RepeatDirection="Horizontal"
Width="88%" Height="100px">
<ItemTemplate>
<table width="0" border="0" cellpadding="0" cellspacing="1">
<tr>
<td>
<%#Eval("Coupon_Image")%>'
</td>
</tr>
<tr>
<td height="20px">
</td>
</tr>
<tr>
<td align="center">
<%--<asp:LinkButton ID="Button1" runat="server" Width="145" Height="34" border="0" CommandArgument='<%# Eval("Coupon_Id") %>'
CommandName="Get Coupoun" OnClick="getCoupon_Click"></asp:LinkButton>--%>
<asp:Button ID="getCoupon" runat="server" Width="145" Height="34" border="0" CommandArgument='<%# Eval("Coupon_Id")%>' Text="Get Coupon"
OnClick="getCoupon_Click" />
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
'
--%>
代码隐藏中的我的代码:
private void Binddata()
{
DataTable dtReport = new DataTable();
DataColumn Coupon_Id = new DataColumn("Coupon_Id");
DataColumn Coupon_Image = new DataColumn("Coupon_Image");
dtReport.Columns.Add(Coupon_Id);
dtReport.Columns.Add(Coupon_Image);
string sendquery = "select Coupon_Id,Coupon_Image from Admin where Coupon_Status='Active'";
SqlDataAdapter da = new SqlDataAdapter(sendquery, connection);
DataSet dsProfile = new DataSet();
da.Fill(dsProfile);
for (int i = 0; i < dsProfile.Tables[0].Rows.Count; i++)
{
DataRow row = dtReport.NewRow();
row["Coupon_Id"] = dsProfile.Tables[0].Rows[i]["Coupon_Id"].ToString();
string id = dsProfile.Tables[0].Rows[i]["Coupon_Id"].ToString();
string ImgName = dsProfile.Tables[0].Rows[i]["Coupon_Image"].ToString();
string Path = "http://localhost:2872/arpita-coupons/Coupon_Image/" + ImgName ;
row["Coupon_Image"] = "<img src='" + Path + "' height='200px' width='200px' />";
hddnpath.Value = Path + ImgName + id;
dtReport.Rows.Add(row);
}
DataList1.DataSource = dtReport;
DataList1.DataBind();
}
protected void getCoupon_Click(object sender, EventArgs e)
{
string id = hddnpath.Value;
string imagename = hddnpath.Value;
Response.Redirect("deals-forms.aspx?id="+id+" & ImgName="+imagename+" "+"");
}
private void Binddata()
{
DataTable dtReport=新DataTable();
DataColumn优惠券Id=新的DataColumn(“优惠券Id”);
DataColumn优惠券图片=新的DataColumn(“优惠券图片”);
dtReport.Columns.Add(优惠券Id);
dtReport.Columns.Add(优惠券图片);
string sendquery=“从优惠券状态为“活动”的管理员处选择优惠券Id、优惠券图像”;
SqlDataAdapter da=新的SqlDataAdapter(sendquery,连接);
数据集dsProfile=新数据集();
da.填充(dsProfile);
对于(int i=0;i
我的问题是,我是否单击按钮以使特定图像重定向到另一个页面。但我得到的只是另一个aspx页面的不同图像 将
id
和imagename
设置为相同的值,然后从这两个值构建链接。我想问题出在某个地方:
string id = hddnpath.Value;
string imagename = hddnpath.Value;
Response.Redirect("deals-forms.aspx?id=" + id // <-- this variable
+ " & ImgName=" + imagename // <-- and this one both
+ " " + ""); // contain hddnpath.Value
string id=hddnpath.Value;
字符串imagename=hddnpath.Value;
Response.Redirect(“deals forms.aspx?id=“+id//string id=hddnpath.Value;string imagename=hddnpath.Value;Response.Redirect”(“deals forms.aspx?id=“+id+”&ImgName=“+imagename+”);实际上,我从中获取id和图像…..例如:有三个图像。如果单击上面的过程,我将获取lat图像..实际上,如果单击按钮,我将获取第一个图像。。