Subscribe to
Posts
Comments

Archive for the '.NET' Category

[csharp]
private void dgNumbers_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.EditItem)
{
DropDownList drpList = (DropDownList)e.Item.FindControl(”drpStyleEdit”);
drpList.Items.FindByText(((BE.ProgrammeStyle)e.Item.DataItem).Description).Selected = true;
}
}
[/csharp]

To reduce page bloat, we move view state to session state, rather than store it in hidden fields. This is done by overriding System.Web.UI.Page’s LoadPageStateFromPersistenceMedium() and SavePageStateToPersistenceMedium() methods.
[csharp]
protected override object LoadPageStateFromPersistenceMedium()
{
return Session["__ViewState"];
}
protected override void SavePageStateToPersistenceMedium(object state)
{
Session["__ViewState"] = state;
}
[/csharp]

Taken from http://scottcate.mykb.com/Article_9BB34.aspx i’ve found the following useful keyboard shortcuts:

Ctrl -
Jumps to last position (previous cursor position)

Ctrl shift -
Jumps forward position

Ctrl i
Incremental search (like Firefox)

The Code Room

Microsoft have just released the pilot episode of “The Code Room”, an MSDN reality show in which real developers have to develop something given tight deadlines. Yes, it really is as boring as it sounds and goes to demonstrate why reality TV and software development haven’t been mixed previously.
The Code Room is probably the worst [...]

Loading several DataTables into a DataSet using DataRelations when there are invalid constraints causes the error message “Failed to enable constraints. One or more rows contain values….”.
Solution is documented here
[csharp]
foreach (DataTable dt in dataset.Tables)
{
if (dt.HasErrors)
{
Console.WriteLine(”ERRORS IN : ” + dt.TableName);
foreach (DataRow dr in dt.GetErrors())
{
Console.WriteLine(dr.RowError);
}
}
}
[/csharp]

Web projects in VS.NET

Spent a couple of hours today trying to open a VS.NET web project in a solution. All inherited code so I can’t change things. Web project won’t open - keeps complaining about “file not found”, or “you are trying to open a web project, you must specify the full root path” etc.
Solution was to add [...]

I’ve been musing for a while over how best to arrange the video links at the bottom of my gallery pages. For ages its just been a server control dumping them out as a table, but I thought tonight i’d try and change it to use a multi-column table instead.
This means using a DataList rather [...]

« Prev