Welcome Guest Search | Active Topics | Sign In | Register

textbox can't be enabled in a toolbar custom item and can't use findcontrol to get item in an eodial Options
Ken Yee
Posted: Wednesday, November 18, 2009 3:30:15 PM
Rank: Member
Groups: Member

Joined: 11/13/2009
Posts: 22
Ran into two separate quirks, so I wrote up one sample app that demonstrates both.
1) you can't enable (so it can be typed into...the color changes from gray to clear though) a textbox that is in a custom item in a toolbar
2) findcontrol doesn't work from a subpage to get a control inside an eodialog that is in a masterpage...I worked around this by accessing that control from the masterpage and adding a method to the masterpage to change it

Masterpage to reproduce these:
=======================
<%@ Master Language="C#" %>
<%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

protected void Page_Load(object sender, EventArgs e)
{
ltrlTestResult.Text = "set from masterpage pageload";
}

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Test Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>

<eo:Dialog runat="server" id="dlgOptions" ControlSkinID="None"
Width="600px" Height="160px"
HeaderHtml="Choose Graph Options"
BorderStyle="Solid" CloseButtonUrl="00070101" AllowResize="True" AllowMove="False"
IsModal="True" BackShadeColor="Blue"
BorderWidth="1px" ShadowColor="LightGray" BorderColor="#335C88" RestoreButtonUrl="00070103"
ShadowDepth="3" ResizeImageUrl="00020014">
<HeaderStyleActive CssText="padding-right: 4px; padding-left: 4px; font-size: 11px; background-image: url(00070104); padding-bottom: 3px; padding-top: 3px; font-family: tahoma"></HeaderStyleActive>
<ContentStyleActive CssText="border-top: #335c88 1px solid; background-color: #e5f1fd"></ContentStyleActive>
<ContentTemplate>
<asp:Literal ID="ltrlTestResult" runat="Server" />
<br />
</ContentTemplate>
</eo:Dialog>


<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
</asp:contentplaceholder>
</div>
</form>
</body>
</html>
====================================
test page:
================================
<%@ Page Language="C#" MasterPageFile="~/Test.master" Title="Test Page" %>
<%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %>

<script runat="server">

protected void Page_Load(object sender, EventArgs e)
{
System.Web.UI.Control customStartItem = ToolBar1.Items[0].CustomItemInstance;
((TextBox)(customStartItem.FindControl("txtStartDate"))).Enabled = true;

ltrlFind1.Text = (Master.FindControl("ltrlTestResult") == null) ? "not found" : "found";
ltrlFind2.Text = (((EO.Web.Dialog)Master.FindControl("dlgOptions")).FindControl("ltrlTestResult") == null) ? "not found" : "found";
}
</script>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

Find using Master: <asp:Literal ID="ltrlFind1" runat="server" />
<br />
Find using find dialog, then find again: <asp:Literal ID="ltrlFind2" runat="server" />
<br />

<eo:ToolBar id="ToolBar1" ClientSideOnItemClick="onToolbarClick"
SeparatorImage="00100204" BackgroundImage="00100203"
Width="100%" BackgroundImageRight="00100202" runat="server">
<DownStyle CssText="BORDER-RIGHT: #335ea8 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #335ea8 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 12px; PADDING-BOTTOM: 1px; BORDER-LEFT: #335ea8 1px solid; CURSOR: hand; PADDING-TOP: 3px; BORDER-BOTTOM: #335ea8 1px solid; FONT-FAMILY: Tahoma; BACKGROUND-COLOR: #ffe1ac"></DownStyle>
<HoverStyle CssText="BORDER-RIGHT: #335ea8 1px solid; PADDING-RIGHT: 3px; BORDER-TOP: #335ea8 1px solid; PADDING-LEFT: 3px; FONT-SIZE: 12px; PADDING-BOTTOM: 2px; BORDER-LEFT: #335ea8 1px solid; CURSOR: hand; PADDING-TOP: 2px; BORDER-BOTTOM: #335ea8 1px solid; FONT-FAMILY: Tahoma; BACKGROUND-COLOR: #ffe1ac"></HoverStyle>
<NormalStyle CssText="PADDING-RIGHT: 4px; PADDING-LEFT: 4px; FONT-SIZE: 12px; PADDING-BOTTOM: 3px; CURSOR: hand; BORDER-TOP-STYLE: none; PADDING-TOP: 3px; FONT-FAMILY: Tahoma; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none"></NormalStyle>
<ItemTemplates>
<eo:ToolBarItem Type="Custom">
<NormalStyle CssText="background-color:transparent;border-bottom-style:none;border-left-style:none;border-right-style:none;border-top-style:none;padding-bottom:1px;padding-left:2px;padding-right:2px;padding-top:2px;" />
<HoverStyle CssText="background-color:transparent;border-bottom-style:none;border-left-style:none;border-right-style:none;border-top-style:none;padding-bottom:1px;padding-left:2px;padding-right:2px;padding-top:2px;" />
<DownStyle CssText="background-color:transparent;border-bottom-style:none;border-left-style:none;border-right-style:none;border-top-style:none;padding-bottom:1px;padding-left:2px;padding-right:2px;padding-top:2px;" />
</eo:ToolBarItem>
<eo:ToolBarItem Type="DropDownMenu">
<NormalStyle CssText="background-image:url('00100205');background-position-x:right;border-bottom-style:none;border-left-style:none;border-right-style:none;border-top-style:none;cursor:hand;padding-bottom:3px;padding-left:4px;padding-right:4px;padding-top:3px;" />
<HoverStyle CssText="background-color:#ffe1ac;background-image:url('00100206');background-position-x:right;border-bottom-color:#335ea8;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#335ea8;border-left-style:solid;border-left-width:1px;border-right-color:#335ea8;border-right-style:solid;border-right-width:1px;border-top-color:#335ea8;border-top-style:solid;border-top-width:1px;cursor:hand;padding-bottom:2px;padding-left:3px;padding-right:3px;padding-top:2px;" />
<DownStyle CssText="BORDER-RIGHT: #335ea8 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #335ea8 1px solid; PADDING-LEFT: 4px; BACKGROUND-POSITION-X: right; BACKGROUND-IMAGE: url(00100206); PADDING-BOTTOM: 1px; BORDER-LEFT: #335ea8 1px solid; CURSOR: hand; PADDING-TOP: 3px; BORDER-BOTTOM: #335ea8 1px solid; BACKGROUND-COLOR: #ffe1ac" />
</eo:ToolBarItem>
</ItemTemplates>
<Items>
<eo:ToolBarItem Type="Custom">
<CustomItem>
<div style="white-space: nowrap;">
<asp:Literal ID="lblStartDate" runat="server" Text="*Start:"
/><asp:TextBox ID="txtStartDate" runat="server" Enabled="false"
style="vertical-align:middle; font-size: 8pt;" Columns="12"
/><asp:Image runat="server" ImageUrl="images/calendar_big.gif"
width="20" Height="20"
style="vertical-align:middle" ID="imgStartSel" />
</div>
</CustomItem>
</eo:ToolBarItem>
<eo:ToolBarItem Type="Custom">
<CustomItem>
<div style="white-space: nowrap;">
<asp:Literal ID="lblEndDate" runat="server" Text="*End:"
/><asp:TextBox ID="txtEndDate" runat="server" Enabled="false"
style="vertical-align:middle; font-size: 8pt;" Columns="12"
/><asp:Image runat="server" ImageUrl="images/calendar_big.gif"
width="20" Height="20"
style="vertical-align:middle" ID="imgEndSel" />
</div>
</CustomItem>
</eo:ToolBarItem>
<eo:ToolBarItem CommandName="Graph" ImageUrl="00101069" Text="Graph" ToolTip="Update Graphs">
</eo:ToolBarItem>
</Items>
</eo:ToolBar>

</asp:Content>

eo_support
Posted: Wednesday, November 18, 2009 5:14:10 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

The texbox issue is a FireFox quirk. You can use the following workaround:

Code: JavaScript
function on_custom_item_mouse_down(event)
{
    if (event)
        event.stopPropagation();
}


Code: HTML/ASPX
<CustomItem>
    <div onmousedown="on_custom_item_mouse_down(event)">
         .....
    </div>
</CustomItem>


FindControl issue is normal. FindControl does not find any child control. It only finds controls inside the same NamingContainer. So in order to have FindControl working correctly, you must call it on the right NamingContainer. In your case you will need to do it this way:

ltrlFind2.Text = (((EO.Web.Dialog)Master.FindControl("dlgOptions")).ContentContainer.FindControl("ltrlTestResult");

Please let us know if those work for you.

Thanks


Ken Yee
Posted: Wednesday, November 18, 2009 5:21:27 PM
Rank: Member
Groups: Member

Joined: 11/13/2009
Posts: 22
Thanks. I was just about to post that the textbox thing only happens in FF :-)
Wow..that ContentContainer thing is convoluted...probably deserves a mention in the help documentation.
Both workarounds work...thanks again.
eo_support
Posted: Wednesday, November 18, 2009 5:27:14 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
You are welcome. Glad that it works for you!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.