ASP.NET - bind the session value with label on page
Asked By Vimal Sharma
03-Feb-12 01:48 AM
I have a label control on my page and i want to bind the price in the session with it .So that it will show the price stored in Session["price"] . So what i will do for bind it
Somesh Yadav replied to Vimal Sharma
Hi go through the below links you will get an clear idea about how to bind the session value with label on page and so on.
http://stackoverflow.com/questions/6938419/asp-net-filling-in-textfields-in-gridview-from-session-variables-for-shoppingcar
http://msdn.microsoft.com/en-us/library/ms972427.aspx
Reena Jain replied to Vimal Sharma
HI,
just keep price in session on page like this
session["price"]=dt.rows[0]["price"].ToString(); //or txtprice.Text;
then on each aspx page took a label to show the price
In on each aspx.cs on page load event write this to show the price on page
label1.Text=session["price"].ToString();
Hope this will help you
dipa ahuja replied to Vimal Sharma
Try this simple code
void getData()
{
SqlConnection conn = new SqlConnection("connstring");
SqlCommand comm = new SqlCommand("SELECT name from table1 where id=1", conn);
conn.Open();
Label1.Text = comm.ExecuteScalar().ToString();
conn.Close();
Session["price"] = Label1.Text;
}
Net hi friends Any one send frequently asked Important questions in C# .Net, ADO .Net, Asp .Net and Sql Server. . . . . . . . tx in Advance. . . . . . Hi, Find this. . (B)What is an IL? (B A) What is scavenging? (B) What are different types of caching using cache object of ASP.NET? (B) How can you cache different version of same page using ASP.NET cache object? (A) How will implement Page Fragment Caching? (B) Can you compare ASP.NET sessions with classic ASP? (B) Which are the various modes of storing ASP.NET session
on to the server in one project now i want to retrive that image in asp .net page so i could i retrive that particular image reply me plz You have to to do this is to use Response.TransmitFile() to explicitly send the file from your ASP.NET application and then add the Content Type and Content-Disposition headers. For example: Response.ContentType database table when u upload that image, than u will be retrive particular image in asp.net page when u needed let me clear one thing , tat r u saving that image the database and bring back the image contents & MIME type for the specified picture using (SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings("NorthwindConnection").ConnectionString)) { const string SQL = "SELECT [MIMEType], [Image] FROM [PictureTable] WHERE [ImageID] = @ImageID
value in your selectedvalue property which generates a primrykey constraint in your data. In this asp.net tutorial you will learn how to implement 3-tier architecture in asp.net using c#. 3-Tier architecture is also called layered architecture. Some people called it n tier architecture. Layer architectures are essentially objects and work in object oriented environment just like asp.net. 3-tier architecture is a very well known architecture in the world of software development application or desktop based, it is the best architecture to use. 3-Tier Architecture in asp.net using c# 3-Tier architecture consists of 1) UI or Presentation Layer 2) Business Access
login coding needed hi frndz, i am doing a project in ASP.net 2.0 c#. In my project i am doing a login page including username and password. i need coding for that login page in asp.net 2.0 c# with sql database connection. please frndz its very urgent help me. thanks InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { SqlConnection Conn = new SqlConnection(ConfigurationSettings.AppSettings["Conn"]); SqlCommand cmd = new SqlCommand("SELECT * FROM Login WHERE uname = '" + txtuname.Text + "' AND pwd = '" + txtpwd.Text + "' ", Conn); Conn.Open(); SqlDataReader
some validation } How to call Server Side function from Client Side Code using PageMethods in ASP.NET AJAX You cannot call server-side code ‘directly’ from client-side code. That is because you will need to use AJAX, and the easiest way out, is to use the ASP.NET AJAX Extensions. One option while using Microsoft ASP.NET AJAX is to call ASP.NET Web services (.asmx files) from the browser by using client script. The script can call