if($('#person_data[document_type]').val() != ''){}
Wednesday, June 18, 2014
Tuesday, June 17, 2014
Common Session methods Use By Creating separate class
//added by shekhar 13/6/2014 To Clear Current Session
public void ClearSession()
{
HttpContext.Current.Session.Clear();
}
//End Of Clear Session
//added by shekhar 13/6/2014 To Remove item in session
public void RemoveFromSession(string key)
{
HttpContext.Current.Session.Remove(key);
}
//end Of remove
public void SetInSession(string key, object value)
{
if (HttpContext.Current == null || HttpContext.Current.Session == null)
{
return;
}
HttpContext.Current.Session[key] = value;
}
public object GetFromSession(string key)
{
if (HttpContext.Current == null || HttpContext.Current.Session == null)
{
return null;
}
return HttpContext.Current.Session[key];
}
public void UpdateInSession(string key, object value)
{
HttpContext.Current.Session[key] = value;
}
public void ClearSession()
{
HttpContext.Current.Session.Clear();
}
//End Of Clear Session
//added by shekhar 13/6/2014 To Remove item in session
public void RemoveFromSession(string key)
{
HttpContext.Current.Session.Remove(key);
}
//end Of remove
public void SetInSession(string key, object value)
{
if (HttpContext.Current == null || HttpContext.Current.Session == null)
{
return;
}
HttpContext.Current.Session[key] = value;
}
public object GetFromSession(string key)
{
if (HttpContext.Current == null || HttpContext.Current.Session == null)
{
return null;
}
return HttpContext.Current.Session[key];
}
public void UpdateInSession(string key, object value)
{
HttpContext.Current.Session[key] = value;
}
use httpcontext and server mappath in a c# class library
1) add using System.Web;
2)string filePath = HttpContext.Current.Server.MapPath("~/TextFiles/StylePath.txt");
2)string filePath = HttpContext.Current.Server.MapPath("~/TextFiles/StylePath.txt");
Monday, June 16, 2014
Access asp.net session value in javascript
var Guest = '<%=HttpContext.Current.Session["Advisorguest"]%>';
Common Logic For Getting Single Value From Database Asp.Net
1) string[,] param1 = new string[1, 2];
param1[0, 0] = "@userName";
param1[0, 1] = username;
2) string status = CommonClass.Common.Instance.getSingleValue("checkIsExistUserName", param1);
3) SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["ValweaveFa"].ConnectionString);
SqlCommand sm;
public string getSingleValue(string procNm, string[,] paramVal)
{
try
{
myConnection.Open();
sm = new SqlCommand(procNm, myConnection);
sm.CommandType = CommandType.StoredProcedure;
for (int i = 0; i < paramVal.Length / 2; i++)
{
if ((paramVal[i, 0] != null) && (paramVal[i, 1] != null))
sm.Parameters.Add(paramVal[i, 0], paramVal[i, 1]);
}
string Password = Convert.ToString(sm.ExecuteScalar());
myConnection.Close();
return Password;
}
catch (Exception ex)
{
throw ex;
}
}
param1[0, 0] = "@userName";
param1[0, 1] = username;
2) string status = CommonClass.Common.Instance.getSingleValue("checkIsExistUserName", param1);
3) SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["ValweaveFa"].ConnectionString);
SqlCommand sm;
public string getSingleValue(string procNm, string[,] paramVal)
{
try
{
myConnection.Open();
sm = new SqlCommand(procNm, myConnection);
sm.CommandType = CommandType.StoredProcedure;
for (int i = 0; i < paramVal.Length / 2; i++)
{
if ((paramVal[i, 0] != null) && (paramVal[i, 1] != null))
sm.Parameters.Add(paramVal[i, 0], paramVal[i, 1]);
}
string Password = Convert.ToString(sm.ExecuteScalar());
myConnection.Close();
return Password;
}
catch (Exception ex)
{
throw ex;
}
}
Subscribe to:
Posts (Atom)