Tuesday, 18 September 2007

Static Selected Style (StaticSelectedStyle) property of ASP.NET Menu Control

Static Selected Style (StaticSelectedStyle) property of ASP.NET Menu Control
When you specify style f0r this property in design time it doesn't work.
You have to work arround a little and write code using c# or vb.net.
I found code for Vb.net and changed it to c#.
The guy was using vb.net code onload event of page. I tried to use my code on page load event but it didn't work
so I am using Data Bound event of menu control.

protected void Menu1_DataBound(object sender, EventArgs e)
{

// Get page name from relative path


string ThisPage = Page.AppRelativeVirtualPath;
int SlashPos = ThisPage.IndexOf("/");
string PageName = Kamboh.MySqlBusinessLogicLayer.Common.Utilities.Right(ThisPage, ThisPage.Length - SlashPos-1);


// Select menu item with matching NavigateUrl property


foreach (MenuItem parentmenu in Menu1.Items)
{
if (parentmenu.NavigateUrl.ToLower() == PageName.ToLower())
{
parentmenu.Selected = true;
break;
}
else

foreach (MenuItem ChildMenu in parentmenu.ChildItems)
{
if (ChildMenu.NavigateUrl == PageName)
{
ChildMenu.Selected = true;
break;
}
}
}


ToLowere() is used to match the name as my values are coming from xml file.
You can replace this line Kamboh.MySqlBusinessLogicLayer.Common.Utilities.Right
with following function
public static string Right(string param, int length)
{
//start at the index based on the lenght of the sting minus
//the specified lenght and assign it a variable
string result = param.Substring(param.Length - length, length);
//return the result of the operation
return result;
}

Wednesday, 8 August 2007

UK contractors rates

Hope you are well? Rather than call you this morning I wanted to send you a quick informative email. I am one of the contract consultants within Premier Group and we have some outstanding candidates available at the moment who are working with us exclusively.

Here is a list of skills we recruit for at the following rates:

1st Line Support £12-£17 per hour

2nd/3rd Line Support £18-£29 per hour

Cisco Consultant £30-£40 per hour

Oracle £30-£40 per hour

Microsoft Developers £35-£50 per hour

Java / J2EE Developers £35-£50 per hour

Project Managers £45-£60 per hour

Business Analysts £45-£60 per hour

Oracle Developers £40-£58 per hour

SAP Consultants £45-£60 per hour

We are also available to search & select and headhunt other niche skills in the marketplace so if you want to test us with a hard to find skill then give me a call.

Wednesday, 23 May 2007

Java script not working in Firefox while works in IE

Hi Friends,
I was using followig java script function to get rollover effects for the images. I am using ASP.NET. Master page and child page and IIS.
This function was working excellent in Internet Explorer (I.E) (but was not working int the Firefox browser.
i was using this function onmouseover and onmouseout events.

where img_name=name of the image source control
and img_src=name of the image to show.


function movepic(img_name,img_src) {
document.forms[0].elements[img_name].src=img_src;
}

I found solution:

If we change the above function as follow it works with both Firefox and I.E
function movepic(img_name,img_src) {
document.getElementById(img_name).src=img_src;


}






Thursday, 3 May 2007

Checking all child nodes of a treeview when parent node checked

Checking all child nodes of a treeview when parent node checked using C# (c-sharp)
It will also expand the parent node to show the children.


private void treeView1_AfterCheck(object sender, TreeViewEventArgs e)
{
if (e.Node.Checked)
{
foreach (TreeNode nd in e.Node.Nodes)
{
nd.Checked = true;
}
//Expand tree node now
e.Node.Expand();
}

}

It's easy guys isn't it?





Wednesday, 25 April 2007

AJAX Vs Response.Write , ASP.NET

Hello Every one,

I realised that when we use AJAX with ASP.Net
Response.Write doesn't work.
Have you came accross this problem ever?