use of session in aspx file.
-
function PikCode(textid) { String myval = document.getElementById(textid).value; alert('myval'); Session["txtcode"] = myval; } In cs file: string txtcode = Convert.ToString(Session["txtcode"].ToString());
Ohh sorry This is how the session is used in javascript, it did not see this
<script language="javascript">
function PikCode(textid)
{
String myval = document.getElementById(textid).value;
alert('myval');
<%=Session("txtcode")%>= myval;
}
</script>Regards Vuyiswa Maseko
Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/
-
Ohh sorry This is how the session is used in javascript, it did not see this
<script language="javascript">
function PikCode(textid)
{
String myval = document.getElementById(textid).value;
alert('myval');
<%=Session("txtcode")%>= myval;
}
</script>Regards Vuyiswa Maseko
Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/
-
hi , ur code is giving following error 'System.Web.UI.Page.Session' is a 'property' but is used like a 'method' Thanks , Amit PAtel
What code are you talking about ?
Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/
-
What code are you talking about ?
Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/
-
<%=Session("txtcode")%> = myval; This statement gives error like, 'System.Web.UI.Page.Session' is a 'property' but is used like a 'method'
ohhh ok change the brackets and make them curly, its true its been used like a method while its not its a session. so that means you need to change it so that it looks like this
<%=Session**["txtcode"]**%> = myval;
Tell me if it helped Regards
Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/
-
ohhh ok change the brackets and make them curly, its true its been used like a method while its not its a session. so that means you need to change it so that it looks like this
<%=Session**["txtcode"]**%> = myval;
Tell me if it helped Regards
Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/
-
ok Please Post the Javascript that you currently have now and the way you access it in the Server side.
Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/
-
ok Please Post the Javascript that you currently have now and the way you access it in the Server side.
Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/
In aspx file, function PikCode(textid) { String myval = document.getElementById(textid).value; <%=Session["code"]%> = myval; } in the cs file, if (!IsPostBack) { txtcode.Attributes["onblur"] = "PikCode('ctl00_ContentPlaceHolder1_txtcode')"; } in the user control i m accessing this session, code is, if (FileUpload1.FileBytes.Length > 0) { if (FileUpload1.HasFile == true) { string txtcode1 = Convert.ToString(Session["code"].ToString()); FileUpload1.SaveAs(Server.MapPath ("~/AdminSection/Products/Chemicals/"+txtcode1+FileUpload1.FileName.ToString())); } } This is my code.
-
In aspx file, function PikCode(textid) { String myval = document.getElementById(textid).value; <%=Session["code"]%> = myval; } in the cs file, if (!IsPostBack) { txtcode.Attributes["onblur"] = "PikCode('ctl00_ContentPlaceHolder1_txtcode')"; } in the user control i m accessing this session, code is, if (FileUpload1.FileBytes.Length > 0) { if (FileUpload1.HasFile == true) { string txtcode1 = Convert.ToString(Session["code"].ToString()); FileUpload1.SaveAs(Server.MapPath ("~/AdminSection/Products/Chemicals/"+txtcode1+FileUpload1.FileName.ToString())); } } This is my code.
-
In aspx file, function PikCode(textid) { String myval = document.getElementById(textid).value; <%=Session["code"]%> = myval; } in the cs file, if (!IsPostBack) { txtcode.Attributes["onblur"] = "PikCode('ctl00_ContentPlaceHolder1_txtcode')"; } in the user control i m accessing this session, code is, if (FileUpload1.FileBytes.Length > 0) { if (FileUpload1.HasFile == true) { string txtcode1 = Convert.ToString(Session["code"].ToString()); FileUpload1.SaveAs(Server.MapPath ("~/AdminSection/Products/Chemicals/"+txtcode1+FileUpload1.FileName.ToString())); } } This is my code.
Try this You are Converting it to string Twice in one code
string txtcode1 = Convert.ToString(Session[""code""]);
If you did this on the server side, it would have been better, you could have a hidden Field and pass the value and access it in the server side. it think the Problem was that the Session name need two double quotes each. Try it
Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/