i have use a datalist in asp.net and c#, it is fatch all value from database, but i wanted when user click any item only those items details navigate to second page , above is my code it is moving only first row value but what about if user select 2nd value
datalise code:
BorderStyle="None" BackColor="White" BorderColor="#E7E7FF" BorderWidth="0px"
DataKeyField="pid" GridLines="Horizontal"
onitemcommand="DataList1_ItemCommand"
onselectedindexchanged="DataList1_SelectedIndexChanged">
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
DynamicServicePath="" Enabled="True" ExtenderControlID="" TargetControlID="Image1" PopupControlID="Panel3"> | Font-Size="XX-Large" Text='<%# Eval("pname") %>' onclick="lbpname4_Click"> | |
Seller's Name Contect Details Email id | ||
<SelectedItemStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
and this is logical code :
protected void lbpname4_Click(object sender, EventArgs e)
{
SqlCommand cmd = new SqlCommand("Select * from AddPost", con);
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
Session["pname"] = dr["pname"];
Response.Redirect("Cate.aspx");
}
con.Close();
}
1 Reply
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
samba sivaPosted Aug 14, 2015, 2:34 AM