Monday, July 27, 2009

Repeater Control scroll to top on post back

There is an issue in the repeater control reset on a post back.

here is my solution ..



// Hidden field to store the last scrolled posistion























// Make sure we register our script is excuted when scrolling event is fired on wrapped DIV

protected void Page_Init(object sender, EventArgs e)
{
this.divChatRepeaterContent.Attributes.Add("onscroll", "javascript:storeScrollValue(this)");
}

Friday, July 24, 2009

The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state

The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state

this error also could come if you have specified the URL to connectiont to the WCF is incorrect .. just figured it out ..!

endpoint address="http://localhost:10780/TranscriptService.svc"

for more details, you need to inspect the InnerException of the exception!

Thursday, July 23, 2009

Security negotiation failed because the remote party did not send back a reply in a timely manner.

Security negotiation failed because the remote party did not send back a reply in a timely manner. This may be because the underlying transport connection was aborted.

very often you might get this error if you have a ASP.NET + WCF project ..

means you need to clean and rebuild the project .. ;)

if didn't work .. delete the WCF reference and re-add . works like a charm

or if u have specified aspNetCompatibilityEnabled="true" . remove it and try. this happend if you have enable WCF + Javasctipt enabled

Security negotiation failed because the remote party did not send back a reply in a timely manner.

Security negotiation failed because the remote party did not send back a reply in a timely manner. This may be because the underlying transport connection was aborted.

very often you might get this error if you have a ASP.NET + WCF project ..

means you need to clean and rebuild the project .. ;)

Wednesday, July 22, 2009

ASP CSS Friendly Control Menu Bug

ASP CSS Friendly Control Menu Bug has a bug when you click on one menu item it's not firing MenuItemClick event ..

after hours of work found the soulution.

Replace the MenuAdapter.cs BuildItem() function with this

private void BuildItem(MenuItem item, HtmlTextWriter writer)
{
Menu menu = Control as Menu;
if ((menu != null) && (item != null) && (writer != null))
{
writer.WriteLine();
writer.WriteBeginTag("li");
writer.WriteAttribute("class", item.ChildItems.Count > 0 ? "AspNet-Menu-WithChildren" : "AspNet-Menu-Leaf");
writer.Write(HtmlTextWriter.TagRightChar);
writer.Indent++;
writer.WriteLine();

if (item.NavigateUrl.Length > 0)
{
writer.WriteBeginTag("a");
writer.WriteAttribute("href", Page.ResolveUrl(item.NavigateUrl));
writer.WriteAttribute("class", "AspNet-Menu-Link");
if (item.Target.Length > 0)
{
writer.WriteAttribute("target", item.Target);
}
if (item.ToolTip.Length > 0)
{
writer.WriteAttribute("title", item.ToolTip);
}
else if (menu.ToolTip.Length > 0)
{
writer.WriteAttribute("title", menu.ToolTip);
}
writer.Write(HtmlTextWriter.TagRightChar);
writer.Indent++;
writer.WriteLine();
}
else
{
// Modified here... add a self refering link back to the menu

writer.WriteBeginTag("a");
writer.WriteAttribute("href", Page.ClientScript.GetPostBackClientHyperlink(menu, "b" + item.ValuePath.Replace(menu.PathSeparator.ToString(), "\\"), true));

writer.WriteAttribute("class", "AspNet-Menu-Link");
if (item.Target.Length > 0)
{
writer.WriteAttribute("target", item.Target);
}
if (item.ToolTip.Length > 0)
{
writer.WriteAttribute("title", item.ToolTip);
}
else if (menu.ToolTip.Length > 0)
{
writer.WriteAttribute("title", menu.ToolTip);
}
writer.Write(HtmlTextWriter.TagRightChar);
writer.Indent++;
writer.WriteLine();

}

if (item.ImageUrl.Length > 0)
{
writer.WriteBeginTag("img");
writer.WriteAttribute("src", Page.ResolveUrl(item.ImageUrl));
writer.WriteAttribute("alt", item.ToolTip.Length > 0 ? item.ToolTip : (menu.ToolTip.Length > 0 ? menu.ToolTip : item.Text));
writer.Write(HtmlTextWriter.SelfClosingTagEnd);
}

writer.Write(item.Text);

if (item.NavigateUrl.Length > 0)
{
writer.Indent--;
writer.WriteLine();
writer.WriteEndTag("a");
}
else
{
writer.Indent--;
writer.WriteLine();
writer.WriteEndTag("a");
//writer.WriteEndTag("span");
}

if ((item.ChildItems != null) && (item.ChildItems.Count > 0))
{
BuildItems(item.ChildItems, false, writer);
}

writer.Indent--;
writer.WriteLine();
writer.WriteEndTag("li");
}
}