Showing posts with label render. Show all posts
Showing posts with label render. Show all posts

Saturday, March 24, 2012

Panel inside an absolute positioned div tag and DropShadowExtender.

I have a Panel inside an absolutly positioned DIV tag. The drop shadowextenders targed control is the Panel. The DropShadow dosn't render properly. It seems to render double the distance of the div from the top and the left side. I am using the Atlas July CTP and the toolkitRelease 60731.

In the example below the div is set to 100px from the left of the page. The DropShadow is then rendered 200px from the left. When I position the div in normal flow it works correctly but this dosn't suit my needs.

Can anyone tell me how to fix this behavoir.

Thanks in advance

David O'Shea

<atlas:ScriptManagerID="ScriptManager1"runat="server"/>

<divstyle="z-index: 101; left: 100px; width: 250px; position: absolute; top: 100px;

height: 228px">

<asp:PanelID="Panel1"runat="server"BackColor="Blue"Height="200px"Width="200px"></asp:Panel></div><cc1:DropShadowExtenderID="DropShadowExtender1"runat="server"><cc1:DropShadowPropertiesOpacity=".8"Rounded="true"TargetControlID="Panel1"TrackPosition="True"/></cc1:DropShadowExtender>

I removed the div tag and set the style of Panel1 to absolute position and it works fine.

Rgds

David O'Shea

Wednesday, March 21, 2012

Partial Page Render not working with Master page

I have a child page using partial page rendering and the web controls are created programmatically. Ajax seems to have a problem with control ID naming when you create your web controls dynamically. When I run this it gives me an object instance error indicating the named control "Lable1" doesn't exist.

Has anyone else run into this problem?

Is there a work around?

Master Page

<%@dotnet.itags.org.MasterLanguage="C#"AutoEventWireup="true"CodeFile="MasterPage.master.cs"Inherits="MasterPage" %>

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

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<title>Untitled Page</title>

</head>

<body>

<formid="form1"runat="server">

<div>

<asp:contentplaceholderid="ContentPlaceHolder1"runat="server">

</asp:contentplaceholder>

</div>

</form>

</body>

</html>

CS child page

<%@dotnet.itags.org.PageLanguage="C#"MasterPageFile="~/MasterPage.master"Title="Untitled Page" %>

<asp:ContentID="Content1"ContentPlaceHolderID="ContentPlaceHolder1"Runat="Server">

<scriptrunat="server">

protectedvoid Page_Load(object sender,EventArgs e)

{

UpdatePanel up1 =newUpdatePanel();

up1.ID ="UpdatePanel1";

up1.UpdateMode =UpdatePanelUpdateMode.Conditional;

Button button1 =newButton();

button1.ID ="Button1";

button1.Text ="Submit";

button1.Click +=newEventHandler(Button_Click);

Label label1 =newLabel();

label1.ID ="Label1";label1.Text ="A full page postback occurred.";

up1.ContentTemplateContainer.Controls.Add(button1);

up1.ContentTemplateContainer.Controls.Add(label1);

Page.Form.Controls.Add(up1);

}

protectedvoid Button_Click(object sender,EventArgs e)

{

((Label)Page.FindControl("Label1")).Text ="Panel refreshed at " +DateTime.Now.ToString();

}

</script>

<div>

<asp:ScriptManagerID="ScriptManager1"runat="server">

</asp:ScriptManager>

</div>

</asp:Content>

Create your controls in the Page_Init vs the Page_Load method.

-Damien


Damien -

I tried creating the controls in the Page_Init and it still will not work. The referrence to the control is still null. Is the page lifecycle timing wrong with the Button_Click event?


Try refering your control with:

YourUpdatePanel.ContentTemplateContainer.FindControl("YourControlName")


I don't have access to the UpdatePanel at design time.


UpdatePanel.ContentTemplateContainer.FindControl("controlName")


Thank you. Seems to work referencing the UpdatePanel "up1". Although you must instantiate "up1" as global. Simple but necessary.