Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts

Monday, July 14, 2008

[C#] Scroll reset when control focused

protected override Point ScrollToControl(Control activeControl)
{
return this.AutoScrollPosition;
}

Tuesday, August 7, 2007

[C#.Net] Read xml from string variable

DataSet myDS = new DataSet();

DataTable myTable = new DataTable("table1");

myTable.Columns.Add("col1", typeof(string));

myDS.Tables.Add(myTable);

string xmlData = "<XmlDS><table1><col1>Value1</col1></table1><table1><col1>Value2</col1></table1></XmlDS>";

System.IO.StringReader xmlSR = new System.IO.StringReader(xmlData);

myDS.ReadXml(xmlSR, XmlReadMode.IgnoreSchema);

Wednesday, July 18, 2007

[ASP.Net] Get Object Value from User Control

[C#]

UserControl.FindControl method

TextBox firstNameTextBox = (TextBox) uc1.FindControl("firstNameTextBox");

Tuesday, June 26, 2007

[C#.Net] Session Class

public class SessionHelper
{
private const string POLICE_PROFILE = "POLICE_PROFILE";

public static PoliceOfficerDS PoliceProfile
{
get
{
if (HttpContext.Current.Session[POLICE_PROFILE] == null)
{
return new PoliceOfficerDS();
}
else return (PoliceOfficerDS)HttpContext.Current.Session[POLICE_PROFILE];
}
set
{
HttpContext.Current.Session[POLICE_PROFILE] = value;
}
}
}