Click here to Skip to main content
15,891,629 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi , I have a listview control with Click Button. I want that if i click on a button then it should get all the data of that row on the basis of Unique ID of that Selected Row. I want it via ListView Property. I have one other method , when i click on Button of any Selected Row then it gets ID of that row in ItemCommand Event of ListView and from here I can call Sql query to get all the columns value of that ID. But I want it without doing this. Kindly help me out. Here is my code below:--

No Images found.

















Zoom


<%--<%#Eval("ImageTitle") %>--%>


<%#Eval("SellingPrice") %>
<%-- Add to cart--%>



<%--

--%>




protected void ImagesList_ItemCommand(object sender, ListViewCommandEventArgs e)
{
if (e.CommandName == "ImgTitle")
{
string shopname = e.CommandArgument.ToString();
Response.Redirect("Item.aspx?vid="+shopname);
}
if (e.CommandName == "AddToCart")
{
int id = Convert.ToInt32(e.CommandArgument);
DataRow[] dr = dt.Select("ID="+id);
// ServiceName,ServiceImage,SellingPrice,MRP
string serviceName = dr[1]["ServiceName"].ToString();
string serviceImage = dr[1]["ServiceImage"].ToString();
float sellingPrice = Convert.ToInt64(dr[1]["SellingPrice"].ToString());
float mrp = Convert.ToInt64(dr[1]["SellingPrice"].ToString());

}

}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900