这是我的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">
<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+" "+"");
}
我的问题是如果我单击按钮以将特定图像重定向到另一个页面。但我只得到另一个aspx页面的不同图像......