how can i pass session value in '<%#Eval("myid")%>'

Posted by Rajupatil under jQuery on 11/27/2012 | Points: 10 | Views : 2712 | Status : [Member] | Replies : 2
Hi all,
<a href="#" class='anchor1' id='<%#Eval("myid")%>'><%#Eval("name")%></a> i use this code in my web appl.
plz tell me how can i pass myid which is stored on session i.e. ( Session["xid"] ).




Responses

Posted by: Sandhyab on: 11/27/2012 [Member] Starter | Points: 25

Up
0
Down
Check this. I done with querystring
protected void Page_Load(object sender, EventArgs e)

{
DataTable table = new DataTable();
if (Request.QueryString["ProductId"] == null ) return;
string ProductId = Request.QueryString["ProductId"];
Session["Id"] = Request.QueryString["ProductId"];

using (SqlConnection conn = new SqlConnection(connStr))
{
using (SqlCommand cmd = new SqlCommand("SELECT * FROM BookDetails WHERE ProductId = @ProductId", conn))
{
cmd.Parameters.Add(new SqlParameter("@ProductId", ProductId));
using (SqlDataAdapter ad = new SqlDataAdapter(cmd))
{
ad.Fill(table);
}

}
}
listview1.DataSource = table;
listview1.DataBind();
}


Rajupatil, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: perfectchourasia-9163 on: 11/30/2012 [Member] Starter | Points: 25

Up
0
Down
<a href="#" class='anchor1' id=' Session["xid"].Tostring() '><%#Eval("name")%></a> i use this code in my web appl.


ER sandeep chourasia
sandeepchrs@yahoo.com (on facebook)
http://www.aspnetcodes.com/

Rajupatil, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response