function ToggleMenuItems(on)
{
var state = "disabled";
if (on)
{
state = "";
}
var element = null;
//Note that "all" will only work for IE - replace with "childNodes" for other browsers
var count = $get("").tBodies[0].rows[0].all.length;
for (var i = 0; i < count; ++i)
{
element = $get("").tBodies[0].rows[0].all[i];
if (element.nodeName == "A")
{
element.disabled = state;
}
}
}
Thank you to: http://forums.asp.net/p/1545146/3775042.aspx
Friday, July 16, 2010
Add ToolTips to listbox items in ASP.NET (VB.NET)
Private Sub MyListBox_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles
MyListBox.PreRender
Dim i As Integer = 0
Dim myToolTips As String() = MyHiddenField.Value.Split("|")
For Each item As ListItem In MyListBox.Items
item.Attributes.Add("title", myToolTips(i))
i = i + 1
Next
End Sub
Thank you to http://msmvps.com/blogs/deborahk/archive/2010/01/31/asp-net-listbox-tooltip.aspx
MyListBox.PreRender
Dim i As Integer = 0
Dim myToolTips As String() = MyHiddenField.Value.Split("|")
For Each item As ListItem In MyListBox.Items
item.Attributes.Add("title", myToolTips(i))
i = i + 1
Next
End Sub
Thank you to http://msmvps.com/blogs/deborahk/archive/2010/01/31/asp-net-listbox-tooltip.aspx
Test for IE using JavaScript
var IE = /*@cc_on!@*/false;
if (IE)
{
//do IE stuff
}
Thank you to http://devoracles.com/the-best-method-to-check-for-internet-explorer-in-javascript.
if (IE)
{
//do IE stuff
}
Thank you to http://devoracles.com/the-best-method-to-check-for-internet-explorer-in-javascript.
Thursday, May 27, 2010
Include a reference to a cascading stylesheet
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
Thursday, May 13, 2010
Fix WCF Service MaxItemsInObjectGraph Error
The error is:
"System.Runtime.Serialization.SerializationException: Maximum number of items that can be serialized or deserialized in an object graph is '65536'. Change the object graph or increase the MaxItemsInObjectGraph quota."
The solution is:
<behavior name="exampleBehavior">
<dataContractSerializer maxItemsInObjectGraph="200000"/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="exampleBehavior">
<dataContractSerializer maxItemsInObjectGraph="200000"/>
</behavior>
</serviceBehaviors>
"System.Runtime.Serialization.SerializationException: Maximum number of items that can be serialized or deserialized in an object graph is '65536'. Change the object graph or increase the MaxItemsInObjectGraph quota."
The solution is:
- Edit the Web.Config file
- Add the following to the <system.serviceModel><behaviors> section:
<behavior name="exampleBehavior">
<dataContractSerializer maxItemsInObjectGraph="200000"/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="exampleBehavior">
<dataContractSerializer maxItemsInObjectGraph="200000"/>
</behavior>
</serviceBehaviors>
- Change the maxItemsInObjectGraph value to whatever the maximum number of items that you need to be serialized is (usually the maximum number of records that your service returns).
Friday, April 16, 2010
Conditional Display of Download Button in ASP.NET GridView TemplateField
<asp:TemplateField HeaderText="Download Document">
<ItemTemplate>
<asp:ImageButton ID="btnDownload" runat="server"
CommandName="Download"
CommandArgument='<%# Eval("Document_ID") & "," & Eval("Document_Name") %>'
ImageUrl="download.png"
ToolTip='<%#"Download " & Eval("Document_Name") %>'
Visible='<%# Not(Eval("Document_ID") = -1) %>' />
</ItemTemplate>
</asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="btnDownload" runat="server"
CommandName="Download"
CommandArgument='<%# Eval("Document_ID") & "," & Eval("Document_Name") %>'
ImageUrl="download.png"
ToolTip='<%#"Download " & Eval("Document_Name") %>'
Visible='<%# Not(Eval("Document_ID") = -1) %>' />
</ItemTemplate>
</asp:TemplateField>
Thursday, April 15, 2010
JavaScript to determine if clicked element has target
function targetExists(e)
{
var retVal = true;
var event = e || window.event;
if (!event.target)
{
event.target = event.srcElement;
}
if (event.target == undefined || event.target == "")
{
retVal = false;
}
return retVal;
}
Adapted from http://snipplr.com/view/2565/which-element-was-clicked (original source was http://quirksmode.org).
{
var retVal = true;
var event = e || window.event;
if (!event.target)
{
event.target = event.srcElement;
}
if (event.target == undefined || event.target == "")
{
retVal = false;
}
return retVal;
}
Adapted from http://snipplr.com/view/2565/which-element-was-clicked (original source was http://quirksmode.org).
Rounded Corners Generator
Web site that creates rounded corners for you http://jalenack.com/roundedstage thanks to Andrew Sutherland.
Tabs Generator
Web site that creates tab graphics for you http://www.tabsgenerator.com thanks to Alex La Rosa and Fabio Fidanza.
Subscribe to:
Posts (Atom)