Showing posts with label panel. Show all posts
Showing posts with label panel. Show all posts

Wednesday, March 28, 2012

Dynamic Creation of CollapsablePanels

I'd like to know how to create a CollapsablePanel in code-behind. My goal is to fetch records from a SQL 05 DB, and create a panel for each record/row in the dataset. I don't know how many rows I'll have, if any, and this means I need to do it on the back end, not in the XHTML code.

Hi,

I made the following sample according to your requirements, please try it:

<%@. Page Language="C#" %><!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) { int numberOfRecordsToBeShown = 10; // this value can be determined by the number of rows in database for (int i = 0; i < numberOfRecordsToBeShown; i++) { Panel pnl = new Panel(); Label lblContent = new Label(); LinkButton lbHeader = new LinkButton(); PlaceHolder1.Controls.Add(lbHeader); PlaceHolder1.Controls.Add(pnl); pnl.Controls.Add(lblContent); lbHeader.ID = "Header" + i.ToString(); lbHeader.Text = "Header" + i.ToString(); pnl.ID = "Row" + i.ToString(); lblContent.Text = "Content to be shown"; AjaxControlToolkit.CollapsiblePanelExtender cpe = new AjaxControlToolkit.CollapsiblePanelExtender(); cpe.ID = "Extender" + i.ToString(); cpe.SuppressPostBack = true; cpe.CollapseControlID = lbHeader.ID; cpe.ExpandControlID = lbHeader.ID; cpe.TargetControlID = pnl.ID; PlaceHolder1.Controls.Add(cpe); } }</script><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> </div> <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder> </form></body></html>
Hope this helps.

I gave it a go, but all I get is 10 lines of 'Content to be shown' on my screen. No collapsing/expanding... nothing, really, except 10 lines of text.


ok, with a few slight alterations, I wound up with this:

protected void Page_Load(object sender, EventArgs e) {
SpewOutCollapses();
}

public void SpewOutCollapses() {
int numberOfRecordsToBeShown = 5; // this value can be determined by the number of rows in database
for (int i = 0; i < numberOfRecordsToBeShown; i++) {
AjaxControlToolkit.CollapsiblePanelExtender cpe = new AjaxControlToolkit.CollapsiblePanelExtender();
StringBuilder sBuild = new StringBuilder();

Panel pnlContainer = new Panel();
Panel pnlHeaderGoal1Update = new Panel();
Label lblContent = new Label();
LinkButton lbHeader = new LinkButton();
PlaceHolder1.Controls.Add(lbHeader);
PlaceHolder1.Controls.Add(pnlContainer);
pnlContainer.Controls.Add(pnlHeaderGoal1Update);
pnlHeaderGoal1Update.Controls.Add(lblContent);

pnlContainer.ID = "pnlContainer" + i.ToString();
pnlContainer.Style.Add("background", "#DFDFDF");

lbHeader.ID = "Header" + i.ToString();
sBuild.Append(" <table class=\"clsOneHundredPercentWide clsBGGreyA clsCursorPointer txtWhiteBold\" style=\"height: 25px;\">");
sBuild.Append(" <tr>");
sBuild.Append(" <td class=\"clsTwoByFivePadding cls25pxHigh clsBold clsLeftAlign\" style=\"width: 15%\">ID " + i.ToString() + "</td>");
sBuild.Append(" <td class=\"clsTwoByFivePadding cls25pxHigh clsLeftAlign\" style=\"width: 85%\">(Show Details...)</td>");
sBuild.Append(" </tr>");
sBuild.Append(" </table>");
lbHeader.Text = sBuild.ToString();

pnlHeaderGoal1Update.ID = "pnlHeaderGoal1Update" + i.ToString();

lblContent.Text = "<div class=\"clsTwoByFivePadding clsLeftAlign\" style=\"padding-right: 10px;\">";
lblContent.Text += " <p>Quisque felis lacus, sodales in, commodo ut, pellentesque sed, orci. Pellentesque congue nisi sed enim. Quisque congue sodales sapien. Suspendisse et lorem ut erat dignissim vestibulum. In hac habitasse platea dictumst. Sed nisl neque, convallis eu, sagittis dignissim, molestie eu, odio. Fusce quam orci, vehicula sollicitudin, tincidunt sed, lobortis dignissim, lectus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed interdum tincidunt mi. Vivamus blandit molestie lectus. Praesent sem lacus, tincidunt nec, placerat ac, feugiat non, tortor. Donec eu pede in neque viverra iaculis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Integer interdum augue quis risus. Pellentesque malesuada elit et eros. In ipsum. Pellentesque eget diam. Aenean quis lorem. Cras et dolor at urna pharetra nonummy. Sed posuere, risus eget suscipit lacinia, ipsum nulla adipiscing sapien, vitae aliquet lacus arcu blandit neque.</p>";
lblContent.Text += "</div>";

cpe.ID = "Extender" + i.ToString();
cpe.SuppressPostBack = true;
cpe.CollapseControlID = lbHeader.ID;
cpe.ExpandControlID = lbHeader.ID;
cpe.TargetControlID = pnlHeaderGoal1Update.ID;
PlaceHolder1.Controls.Add(cpe);
}
}

It works great, but that brings me to part 2 of my question: Is there a way to generate SUB collapsers in this... to in effect nest collapsing panels in collapsing panels. I can hard-code that, but I would love to generate it. What I want is, inside the existing panel generation, to generate a single collapsablePanel (so that each collapser has one nested collapser inside). Think that's possible?


Ok, let's forget the nesting for the moment, and think instead about something else: can you explain, possibly, why the panels start fully expanded?


Morydyn:

Ok, let's forget the nesting for the moment, and think instead about something else: can you explain, possibly, why the panels start fully expanded?

By default, the initial state is expanded. You can change it to collapsed explicitly.

cpe.ID = "Extender" + i.ToString();
cpe.Collapsed = true;
cpe.SuppressPostBack = true;

Dynamic controls in Ajax UpdatePanel

I created a dynamic button and want to add the button click event as update panel trigger.
But does not work. Any idea ?
Thanks

String clientID;

protectedvoid Page_Init(object sender,EventArgs e)

{

Button btn =newButton();

btn.Text ="Write Hello";

btn.Click +=newEventHandler(Button1_Click);

Page.Form.Controls.Add(btn);

clientID = btn.ClientID;

}

protectedvoid Button1_Click(object sender,EventArgs e)

{

Label1.Text ="hello";

}

protectedvoid Page_PreRender(object sender,EventArgs e)

{

AsyncPostBackTrigger trigger =newAsyncPostBackTrigger();

trigger.ControlID = clientID;

trigger.EventName ="Click";

UpdatePanel1.Triggers.Add(trigger);

}

Try this instead of your code.

protected void Page_Load(object sender, EventArgs e)
{

Button btn = new Button();
btn.Text = "Write Hello";
btn.ID = "Button1";
btn.Click += new EventHandler(Button1_Click);
UpdatePanel1.ContentTemplateContainer.Controls.Add(btn);
//Page.Form.Controls.Add(btn);
// clientID = btn.ClientID;

AsyncPostBackTrigger trigger = new AsyncPostBackTrigger();
trigger.ControlID = "Button1";
trigger.EventName = "Click";
UpdatePanel1.Triggers.Add(trigger);

}
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = "hello";

}


This works. But actually what I want is : when click on the Button1, the the UpdatePanel1 will be hide and a UpdateProgress (with a loading image) will show until the loading complete. And the UpdatePanel1 will show again with some updated info.


Try this code. I dont think its a perfect way. I am using some hack mentioned in

http://dotnetslackers.com/community/blogs/simoneb/archive/2006/09/02/481.aspx

<%@. Page Language="C#" %
<!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)
{

Button btn = new Button();
btn.Text = "Write Hello";
btn.ID = "Button1";
btn.Click += new EventHandler(Button1_Click);
UpdatePanel1.ContentTemplateContainer.Controls.Add(btn);
//Page.Form.Controls.Add(btn);
// clientID = btn.ClientID;

AsyncPostBackTrigger trigger = new AsyncPostBackTrigger();
trigger.ControlID = "Button1";
trigger.EventName = "Click";
UpdatePanel1.Triggers.Add(trigger);
}
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = "hello";
System.Threading.Thread.Sleep(4000);
}
</script
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID=sc1 runat=server ScriptPath="ScriptLibrary"></asp:ScriptManager>
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server"Text="Label"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgressrunat=server AssociatedUpdatePanelID=Updatepanel1 ID=up1DynamicLayout=true DisplayAfter=4 >
<ProgressTemplate>
<table>
<tr>
<td>
Loading......
</td>
</tr>
<tr>
<td>
<img src="http://pics.10026.com/?src=" alt="image" />
</td>
</tr>
</table>
</ProgressTemplate>
</asp:UpdateProgress>
</div>
</form>
</body>
</html>
<script language=javascript>
Sys.Application.add_load(ApplicationLoadHandler)
function ApplicationLoadHandler(sender, args)
{
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(HidePanel);
Sys.WebForms.PageRequestManager.getInstance().add_pageLoading(ShowPanel);
}
function HidePanel(sender, args)
{
for (var j = sender._updatePanelIDs.length - 1; j >= 0; j--)
{
varupdatePanel =document.getElementById(sender._uniqueIDToClientID(sender._updatePanelIDs[j]));
var postbackElement = args.get_postBackElement();
if(updatePanel && updatePanel.contains(postbackElement)) {
updatePanel.style.visibility='hidden';
}
}
}
function ShowPanel(sender, args)
{
var updatedPanels = args.get_panelsUpdating();
for (var j = updatedPanels.length - 1; j >= 0; j--)
{
updatedPanels[j].style.visibility='visible';
}
}
</script>


Is it posible to put the button outside the UpdatePanel ?

UpdatePanel1.ContentTemplateContainer.Controls.Add(btn);

Because I would not want the button to be hide while 'Ajax'.

Thanks

Dynamic AJAX loaded control with updatepanel problem.

Hi,

Hopefully someone can shed some light onto whether this can be done as I am not having much luck so far.

I have a page with an Update panel. On this page I have a button that through an asynchronous postback loads a usercontrol (lets call it A). The usercontrol that is loaded (A) also has an update panel and a button. When the button on the usercontrol (A) is clicked I want it to load another usercontrol (B) through ajax into the updatepanel.

So we have nested usercontrols and updatepanels - the page hosts Usercontrol A which hosts usercontrol B.

Loading the Usercontrol A is working without a problem and I am persisting the loaded control by use of viewstate and reloading the controls in the OnInit event.

However clicking the button on usercontrol A will not load the usercontrol (B). This is because the click event behind the button does not fire.

I would be grateful if anyone has tried this and found a way of making it work.

Thanks

Hi,

Can you post a simple and clear sample here?


Hi, nzwy1p

Since you dynamically add the first(parent) user control, you should add it to the PlaceHolder in the Page_Load event every time instead of adding it just in theButton's Click event. Because when you only add it in theButton's Click event, after post back, theuser controlwill disappear. And itdoesn't land on your breakpoint inButton1_Click inUserControlA.ascx,There is non UserControlA when your postback by clickingButton1 in theUserControlA.

Try this:

Page:

<%@. Page Language="C#" %>

<!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 Button1_Click(object sender, EventArgs e)
{
UpdatePanel1.Update();
}

protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack)
{
UserControl uc;
uc = (UserControl)LoadControl("UserControlA.ascx");
PlaceHolder1.Controls.Add(uc);
}
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" />
</Triggers>
</asp:UpdatePanel>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /></div>
</form>
</body>
</html>

UserControlA:

<%@. Control Language="C#" ClassName="UserControlA" %>

<script runat="server">
protected void Button1_Click(object sender, EventArgs e)
{
UserControl uc;
uc = (UserControl)LoadControl("UserControlB.ascx");
PlaceHolder1.Controls.Add(uc);
}
</script>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" />
</Triggers>
</asp:UpdatePanel>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button in UserContorlB" />

UserControlB:

<%@. Control Language="C#" ClassName="UserControlB" %>

<script runat="server">

</script>

<asp:Label ID="Label1" runat="server" Text="UserContorlB's content"></asp:Label>

For more help, You can see theselink:http://forums.asp.net/t/1108394.aspx

Let me know if you need more info

Monday, March 26, 2012

dynamic addhandler not working in update panel

hi all,

i have designed a page, with a place holder in it, the placeholder is inside a updatepanel, the placeholder gets filled with images at load, and when i click the viewcart button it get filled with the image information with few dynamic buttons, i have added addhandler for those buttons, but they are not firring up. i am pasting my code here if some one can help me plz.

Dim

updateorderlnkbtn AsNew button ' this is done at the genearal section of the page to make it globalAddHandler updateorderlnkbtn.click,AddressOf cancelBtn_click ' at page init

please help me

hi all

i have done some other changes to the code but still the same problem, if any one of you can give me some idea that would be highly appreciated

thanks


hi all

I have done some thing here that my 5 static buttons that are created at runtime are working fine now but the problem is with the dynamic table, i am placing a delete button in the dynamic table now the dynamic table is created at runtime and i want the delete button to remove the row.

the other buttons (5 buttons) code is something like this , i have wrote the code behing the load, the problem is that i can't wrote the dynamic table code behind the load, the dynammic table is created when i click a viewcart button

please help

DropShadowExtender; Showing up on Top

I am using VS2008 and the included AJAX Control ToolKit

I have a master page that includes the scriptmanager and a panel with the DropShadowExtender

I have added a content page, that has a panel with a DropShadowExtender.

When the page displays, the 2nd DropShadow, goes UP, and displays on the top of the box. Basically an UPShadowExtender.

Any ideas to correct?

I have noticed a similar situation in the past if I am using tables or panels (and I would presume divs as well since panels are rendered as divs) I am trying to recall exactly what solved the issue but I do recall it had something to do with the width of each of the elements. I beleive if I had a table and had the extender to another control within that table, and the content in that table forced the outter table (or panel) to expand, I noticed that the dropshadow extender would push upwards.

Basically, what Im trying to say is, check your table, div, panel widths and heights. Make sure the content has ample room.


Hi,

Thank you for your post!

Create a simple repro for this issue if you can,and please post up the whole code of the repro.

Anyway, I agree withjgilmore. you should do moretroubleshoot wok and then you can provide us with more valuable information.

Best Regards,

DropShadowExtender with rounded corner & header

Hi,

I have a panel that I added a DropShadowExtender with rounded corner too. I would like to add a header.

Can this be done without adding a label to the panel to act as a header text?

I am not completely clear so I have misunderstood this please clarify further. Any markup inside the panel that is serving as a header whether it be an asp.net label or just text inside a styled div should work just fine.

DropShadowExtender problem

Hi

I am trying to place a DropShadowExtender for an asp:panel which is bound with HoverMenuExtender. So if the user hovers over a link, the panel will show up and drops a shadow. But the problem is the shadow is always showing up and when a user hovers away from the link the hovermenu dissapers but shadow remains there. Anyone knows a solution?

Thanks.

Hi Zeeshan,

I would recommend adding anotherPaneland have the DropShadowExtender point to the old one and theHoverMenuExtender point to the new one. If your currentPanel has the IDMyPanel, then you would want something that looked like this:

<asp:Panel id="WrapperPanel" runat="server" ... >
<asp:Panel id="MyPanel" runat="server" ... >
...
</asp:Panel>
</asp:Panel>
<atlasToolkit:DropShadowExtender ID="dse" runat="server">
<atlasToolkit:DropShadowProperties TargetControlID="MyPanel" ... />
</atlasToolkit:DropShadowExtender>
<atlasToolkit:HoverMenuExtender ID="hme" runat="Server">
<atlasToolkit:HoverMenuProperties PopupControlID="WrapperPanel" ... />
</atlasToolkit:HoverMenuExtender>

Thanks,
Ted


Thank you so much Ted. I was wondering if I can have fade in/out effect on my HoverMenuExtender. I tried doing it with scripts on my page but it doesn't work as the panel is under control of the extender so the effect doesn't show up. Anyone knows any other way around?

Thanks


Hi Zeeshan,

Right now the only way to change the visual effects for any of the controls is to change the script. This is even more complicated forHoverMenuBehavior.js because you'll notice that it uses theSys.UI.HoverBehavior andSys.UI.PopupBehavior classes defined by "Atlas".

Thanks,
Ted

DropShadowExtender not attached to its panel

HELP PLEASE!!! I have put a DropShadowExtender on my login panel but when I run it, the dropshadow is completely detached from the panel itself! It is the correct size, shape, opacity, but the shadow is appearing a few inches down and to the right of the panel.

I've been banging on this for a WEEK and my head's about to explode.

1<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
2 <asp:ScriptManager ID="sm" runat="server" EnablePartialRendering="true" />
3 <asp:Panel ID="pnlLogin" runat="server" CssClass="LoginShadow">
4 <div style="padding:10px ; z-index:115">
5 User Name: <asp:TextBox ID="UserName" runat="server"></asp:TextBox><br />
6 Password: <asp:TextBox ID="Password" runat="server"></asp:TextBox><br />
7 <hr />
8
9 <asp:Button ID="LoginButton" runat="server" BackColor="#FFFBFF" BorderColor="#CCCCCC"10 BorderStyle="Solid" BorderWidth="1px" CommandName="Login" Font-Names="Verdana"11 Font-Size="0.8em" ForeColor="#284775" Text="Log In" ValidationGroup="Login"
12 OnClick="LoginButton2_Click">
13 </asp:Button>
14 </div>
15 </asp:Panel>
16 <ajaxToolkit:DropShadowExtender ID="dse1" runat="server"17 TargetControlID="pnlLogin"
18 Width="5"19 Rounded="true"20 Radius="6"21 Opacity=".7"22 TrackPosition="true"></ajaxToolkit:DropShadowExtender>
23</asp:Content>
What happens if you remove the HR tag? (Which forces line breaks...)

DropShadowExtender in a table

Hello,

Does anyone know why the DropShadowExtender doesn't show correctly when the panel control that it calls is under an html table?

The main problem is with the shadow.

Thanks

A simple sample page demonstrating the problem would probably be helpful here.


Some say an image is worth more than 1000 words

As you can see the top an bottom borders look funny.

That is using the same example as the one that the toolkit has, and only inserting the panel into a table, very simple, like this

<table>
<tr>
<td>
<asp:Panel ID="Panel1" runat="server" CssClass="dropShadowPanel" Width="500px">
<div style='padding: 10px'>
<p>
First Name:
<asp:TextBox ID="TextBox1" runat="server" Style='position: absolute; left: 100px;
width: 150px"></asp:TextBox>
</p>
<p>
Last Name:
<asp:TextBox ID="TextBox2" Style='position: absolute; left: 100px; width: 150px'
runat="server"></asp:TextBox>
</p>
<hr />
</div>
</asp:Panel>
</td>
</tr>
</table>

Thanks


I think it may have something to do with one of the other styles/attributes of your page. The below page containing your TABLE above and the necessary framework to get a drop shadow looks fine to me in IE6:

<%@. Page Language="C#" %><%@. Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="atlasToolkit" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> <atlas:ScriptManager ID="SM" runat="server"> </atlas:ScriptManager> <table> <tr> <td> <asp:Panel ID="Panel1" runat="server" CssClass="dropShadowPanel" Width="500px" Style="background-color: Lime"> <div style='padding: 10px'> <p> First Name: <asp:TextBox ID="TextBox1" runat="server" Style="position: absolute; left: 100px; width: 150px"></asp:TextBox> </p> <p> Last Name: <asp:TextBox ID="TextBox2" Style='position: absolute; left: 100px; width: 150px' runat="server"></asp:TextBox> </p> <hr /> </div> </asp:Panel> </td> </tr> </table> <atlasToolkit:DropShadowExtender ID="DSE" runat="server"> <atlasToolkit:DropShadowProperties TargetControlID="Panel1" Rounded="true" /> </atlasToolkit:DropShadowExtender> </div> </form></body></html>

Hi David,

Thank you for your answer.

I checked out the code for any differences, since it looked pretty much the same as mine. It had a few differences, and I removed some code until I found out what was causing it.
The problem is the Opacity property in DropShadowProperties, if you set that to any value < 1 then you will see the bug.


Weird. My sample looks fine for me in IE6 SP1 even with Opacity="0.5".

DropShadowExtender display issue

Im jsut playing about with the drop shadow extender and when i come to use it for the first time i have hit a major snag.

I have bound it to a panel which contains some text, when i run the page, i get the rounded corners of the panel, but the shadow (or I shoud say a black image the same size of the panel) appears about an inch lower down on the screen and not even remotely connected to the panel, let alone behind it to give a shadow effect.

Anyone else run into this?

I am having the same issue. Is there a solution to this?



...Have you tested this in both IE7 and FireFox?

If it displays properly in one but not the other it's probably due to HTML rendering.

You can resolve this behavior by removing HTML tags, especially tags like HTML header tags.
Replace them with ASP.NET CSS, then they should render properly in the toolkit div sections.


Yes, it's hosed the same in Firefox.

Surely someone, somewhere is using this thing somehow got it working outside of the samples.

I've recreated this page four times now and it's still not working correctly.

DropshadowExtender disappear on gridview selected index changes

Hello,

I have a gridview inside a panel wich is inside an updatepanel. My problem is when I click on my gridview and I select a row the shado and the rounded corners of the panel around the gridview disappear.

I can see the dropshadowextender, only on the first page load, after it disappears. I can't find any solution to keep the rounded corner and the shadow

Please try your scenario with the recently available61121 release of the Toolkit (and ASP.NET AJAX Beta 2). If the problem persists, then please reply with acomplete, self-contained sample page that demonstrates the problem so that we can investigate the specific behavior you're seeing. Thank you!

DropShadowExtender brought shadow in part area of the Table not only in a expectation area

Hi all,

Does yourDropShadowExtender work well? I added a panel outside of a Tabel in an existing system and usedDropShadowExtenderat the panel. But it brought shadow in part area of the table not only in the expectation area.

What's wrong?

Thanks in advance.

lsw93

Hi all,

I fixed it by adding background color (white) to the wrong shadow area.

thanks,

lsw93

DropShadowExtender and target panel separate when window is resized

So here's what's up.

I've got a horizontally scrolling asp panel.

In the panel is a datalist which repeats horizontally.

I have a web user control set as the item template. The user control makes use of the DropShadowExtender.

It works beautifully, until the window is resized, then the shadows and user controls part their ways.

Any ideas?

hello?

DropShadowExtender and asp .net 2.0 Menu Control

Hi, i'm having a problem using DropShadowExtender, when i use it in a panel bellow my menu (menu displaying items in hotizontal with children), the children menu items, appear behind the panel witch the DropShadowExtender is bounded.

Has anyone expererienced this? If so is there a simple solution to it?

I've tried to change several properties of the div where my menu is inserted, and did'nt work.

Thanks.

hi joao_matos,

Could you provide some sample code that shows what's going wrong? I'm not quite following your description.

Thanks,
Ted

Saturday, March 24, 2012

DropShadowExtender

I have a masterpage with the code below.

I have a Default.aspx page that uses the masterpage.

When Rounded is set to false then I get a panel with a shadow. If i changes Rounded to true, then I get two small areas (one white and one black). What am I doing wrong.

Best regards

S?ren Agerbo Jensen.

-------

MasterPage.master:

<%@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>FraIdeTilFaktura.dk</title>

</

head>

<

bodyalign="center"style="filter:progid:DXImageTransform.Microsoft.Gradient(endColorstr='#EEEEEE', startColorstr='#555555', gradientType='0'); padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px;"><formid="form1"runat="server"style="text-align: center;"><div><tableborder="0"cellpadding="0"cellspacing="0"style="height: 600px; width: 80%;"><tr><tdstyle="width: 100%; height: 50px;"></td></tr><tr><tdid="tekst"style="width: 100%; height: 400px;"><asp:ScriptManagerID="ScriptManager1"runat="server"></asp:ScriptManager> <ajaxToolkit:DropShadowExtenderRounded="false"ID="DropShadowExtender1"runat="server"TargetControlID="Panel1"Radius="2"TrackPosition="true"Width="5"></ajaxToolkit:DropShadowExtender><asp:PanelID="Panel1"runat="server"Height="100%"Width="100%"BackColor="White"ScrollBars="Auto"><

<

asp:ContentPlaceHolderID="ContentPlaceHolder1"runat="server"></asp:ContentPlaceHolder></asp:Panel></td></tr><tr><tdstyle="width: 100%; height: 50px;"></td></tr></table></div></form>

</

body>

<

scripttype="text/javascript">

document.getElementById(

"tekst").style.height=screen.height-300;

</

script>

</

html>

Sorry for the trouble - pleaseopen a work item to report and track this issue. Thank you!

DropShadow visible when PopupControl is not...

So I'm trying to attach a DropShadowExtender to the same panel that is already attached to a PopupControlExtender. There are two issues that arise.

First, the shadow is always visible on the page even when the control is hidden by the PopupControlExtender.

Second, the shadow displays where the control would be located in its original position if all atlas code is removed from the page. When you first click on the control that causes the PopupControl to display the shadow jumps to where the control is now visible, as specified by the properties of the PopupControlExtender (offset some x and some y a certain direction from whatever control).

Can I modify the DropShadowExtender in some way to hide itself? Or do I have to try and create a new hybrid control that incoporates both the DropShadow and the Popup behavior together?

Have you tried setting TrackPosition="true" on the DropShadow?

Yes, I have the TrackPosition="true". Here, look at these pictures and maybe they will give you a better idea of what is happening.

This is how the page looks when it first loads:http://i48.photobucket.com/albums/f242/Braigo64/Popup_1.jpg
The popup is hidden but the dropshadow attached to it shows up.

This is how the page looks when you click the information icon:http://i48.photobucket.com/albums/f242/Braigo64/Popup_2.jpg
The popup appears and the dropshadow moves to the proper place.

This is how the page looks when the popup is dismissed:http://i48.photobucket.com/albums/f242/Braigo64/Popup_3.jpg
The popup is hidden again, but the dropshadow still shows up.

The question is, how can I hide the dropshadow? Is there a simple fix? Or do I have to create a new controlextender that incorporates both the popup behavior AND the dropshadow behavior on a control?


Thanks for the pictures - good demonstration of the problem!

I've played around with this a bit just now and find that adding the following lines to the end of this.setShadow in DropShadowBehavior.js fixes the problem for me when I try to simulate your scenario:

if (_shadowDiv) { _shadowDiv.get_style().visibility = this.control.element.style.visibility;}

The change simply makes the shadow DIV's visibility match that of the control it's shadowing.

Can you please give this a try and let me know? If it works for you, too, then I'll open a work item to make a change like this to DropShadow permanent.


Thank you. That indeed corrected the problem. This should definitely be part of the default behavior of the DropShadow.

The only thing is the shadow slightly lags behind the popup item when vanishing, but only for a split second. It's a minor glitch I can overlook for now. :P

Thanks again.


Now work item 709.

This has been checked in for the next Toolkit release. Check-in notes:

DropShadow now sets the visibility style of the shadow to match that of the TargetControlID. This allows it to auto-hide when hooked up to, for example, PopupControl. The default timer interval for the TrackPositionDelay mode was decreased from 100ms to 50ms to improve the default experience (note that the default delay can be changed via a script call to set_TrackPositionDelay if necessary). The PopupControl sample has been modified to include a DropShadow for the popups.


Is this in the June release (60626)?

I am using this release and still have this problem.

Andy.


It appears first in thenew 60731 release.

Cool, you lot really are on the ball!

Keep up the good work.

Andy.


Hey, ignorant question here, since I truly don't 'get' how the rounded corner extender actually does its job... but is there anyway to make sure that a rounded box drops a rounded shadow?
It will by default if both extenders are used.
I must've grabbed an older dll, then, b/c it doesn't on my machine. I'll try w/ the the latest one advertised above.

Ok, so I tried it with the latest release and the 'default' made a square shadow that's black. furthermore, the background color of the Div (set through a id-based selector in the css) only shows up where the rounded corners were, the rest of it were apprently transparent, as the shadow was showing through and where the shadow is indented on the left, it showed the background of the page itself.

I set some of the properties, namely opacity and rounded, and I got a lighter gray, rounded-corner dropshadow (as expected from your suggestions)... and still my div was transparent except where the rounded corner part is.

Interestingly enough, I did some mucking around and it appears that the thing that makes it break like that is setting the style (in this case height, width, and background-color) using the id-based selector. Haven't investigated the extender's code yet to see why that is, but when I moved the style info to a class in the same css instead of in the id-based selector, it worked fine. If I had to guess, I'd say that the controls probably look to see what the current style of the control is using the class(?). As good a guess as any until I ahve time to dig in deeper.


Yes - we need to get better about this. It's a problem with the DOM in general with computing "current" styles. We're not entirely consistant here.

Basically the problem is that

element.style.width

Will return a value for:

<div style="width:200px"/>

but not always for

.myStyle {

width:200px;

}

<div class="myStyle"/>

DropShadow panel within another dropshadow panel

Hello,


I am trying to put a drop shadow extender on a panel around another drop shadow extender but the inside panel is acting funny. I have the panel rounded and looks great but the black shadow part is distorted and at the bottom of the indside panel ? I have tried position absolute in a few places and tried putting a div around it but still no change...

Any thoughts?

So, you are trying to nest one DropShadowExtender on a panel within another DropShadowExtender panel?
That is exactly what I am trying to do... Does anyone know how to make this work?

DropShadow not moving?

I have a DropShadow attached to a panel that is also a DragPanel and a ModalPopup. What happens is that I can move the panel but the shadow is moving after I drop the panel and not during the drag phase, then after I drop the panel the shadow redraws itself at the right place.

What can I do?

DropShadow in TrackPosition mode uses window.setTimeout to check for movement of its TargetControlID. It sounds like that event isn't firing during the drag operation and so you're not getting updated shadow positions. (Does this happen on all browsers?) You might consider making the DragPanel apply to a Panel that contains both the current content AND the DropShadow that's being attached to it. Then there won't be positioning to update since the shadow will automatically travel with its content.


Thank you David.

DropShadow Extender: Opacity-property problem

I create Atlas-website, put ScriptManager on top of the page, add panel and set height, width and background-color properties. Then i add AtlasToolkit Dropdown Extender on the page ja set it's properties. My problem is that the dropshadow is only visible when Opacity is set to 1.0. If I set Opacity-property to less than 1.0 eg. 0.75, Panel-control doesn't show drop shadow. Am I missing something?

DropShadow-sample page works though..

Which browser are you using? But you're saying the sample is working okay, so I'm not sure what's wrong. If opacity is 1.0, the extender doesn't bother to apply the OpacityBehavior, which manages the opacity property. It would be interesting to see if the OpacityBehavior works on your panel. Maybe take a closer look at any differences between the sample and your page?


I'm using IE6 & IE7.

This markup with opacity set to .7 doesn't show dropshadow for panel:

<%@.PageLanguage="VB"AutoEventWireup="true"CodeFile="Default.aspx.vb"Inherits="_Default"%>

<%@.RegisterAssembly="AtlasControlToolkit"Namespace="AtlasControlToolkit"TagPrefix="atlasToolkit"%>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

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

<headrunat="server">

<title>mySample Page</title>

<styletype="text/css">

.panelStyle {

width:350px;

height:250px;

background:#517dbf;

}

</style>

</head>

<body>

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

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

<div>

<asp:PanelID="Panel1"runat="server"CssClass="panelStyle">

</asp:Panel>

<atlasToolkit:DropShadowExtenderID="DropShadowExtender1"runat="server">

<atlasToolkit:DropShadowProperties

TargetControlID="Panel1"

Width="5"

Opacity=".75"

TrackPosition="true"

Rounded="false"/>

</atlasToolkit:DropShadowExtender>

</div>

</form>

<scripttype="text/xml-script">

<page xmlns:script="http://schemas.microsoft.com/xml-script/2005">

<references>

</references>

<components>

</components>

</page>

</script>

</body>

</html>

But when I add the checboxlist w/ onclick-events from the samplepage , dropshadow is visible when checkbox is checked: now opacity values from .25 to .75 are working ok.

On DesignView DropShadowExtender1-Control displays error-text: 'TargetProperties' could not be initialized. Details: 'TargetProperties' could not be added to the collection. Details: 'dsBehavior' could not be set on property 'ID'. Doesn't throw any run-time errors.

<%@.PageLanguage="VB"AutoEventWireup="true"CodeFile="Default.aspx.vb"Inherits="_Default"%>

<%@.RegisterAssembly="AtlasControlToolkit"Namespace="AtlasControlToolkit"TagPrefix="atlasToolkit"%>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

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

<headrunat="server">

<title>mySample Page</title>

<styletype="text/css">

.panelStyle {

width:350px;

height:250px;

background:#517dbf;

}

</style>

</head>

<body>

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

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

<div>

<asp:PanelID="Panel1"runat="server"CssClass="panelStyle">

</asp:Panel>

<atlasToolkit:DropShadowExtenderID="DropShadowExtender1"runat="server">

<atlasToolkit:DropShadowProperties

ID="dsBehavior"

Opacity=".75"

Rounded="false"

TargetControlID="Panel1"

TrackPosition="true"

Width="5"/>

</atlasToolkit:DropShadowExtender>

</div>

<divstyle="padding: 15px;">

<labelfor="chkShadow">

Show Drop Shadow:

</label>

<inputid="chkShadow"checked="checked"onclick="var b = $object('dsBehavior'); b.set_Width(chkShadow.checked ? 5 : 0);"

type="checkbox"/><br/>

<labelfor="chkRounded">

Rounded:

</label>

<inputid="chkRounded"checked="checked"onclick="var b = $object('dsBehavior'); b.set_Rounded(chkRounded.checked);"

type="checkbox"/>

<div>

Opacity:

<inputid="opacity25"name="opacityValues"onclick="$object('dsBehavior').set_Opacity(this.value);"

type="radio"value=".25"/><labelfor="opacity25">25%</label>

<inputid="opacity50"name="opacityValues"onclick="$object('dsBehavior').set_Opacity(this.value);"

type="radio"value=".5"/><labelfor="opacity50">50%</label>

<inputid="opacity75"checked="checked"name="opacityValues"onclick="$object('dsBehavior').set_Opacity(this.value);"

type="radio"value=".75"/><labelfor="opacity75">75%</label>

<inputid="opacity100"name="opacityValues"onclick="$object('dsBehavior').set_Opacity(this.value);"

type="radio"value="1.0"/><labelfor="opacity100">100%</label>

</div>

</div>

</form>

<scripttype="text/xml-script">

<page xmlns:script="http://schemas.microsoft.com/xml-script/2005">

<references>

</references>

<components>

</components>

</page>

</script>

</body>

</html>


My best guess is that this has something to do with your video card/driver. I'm not sure how IE (or FireFox) does opacity but your first sample works fine for me for all Opacity values. Note I also do not get the design time errors you're mentioning, but that shouldn't affect the runtime behavior. Does it work in other browsers for you?

I've tried with FF & IE and two different laptops with same results (both laptops have VS 2005 Team Developer installed). I don't think it's video card/driver 'cause SamplePage's checkboxlist w/ onclick-events works ok. (BTW i have NVIDIA FX 1400 Go 256Mt-video card.) DesignView error happens when I add ID-property for the DropShadowProperties. Error disappears when I remove ID-property.

IntelliSense shows only "Opacity, Rounded, TargetControlID, TrackPosition and Width"-properties, no Id-property? I uninstalled and reinstalled all Atlas relatud stuff and created a new Atlas-website, but no dropshadow with opacity less than 1.0.

I'll keep digging.. or just use CSS-based dropshadows..Sad [:(]


This markup displays default dropshadow with opacity 1.0:

<

atlas:ScriptManagerID="ScriptManager1"runat="server"EnablePartialRendering="true"/><div>
<asp:PanelID="Panel1"CssClass="panelStyle"runat="server"></asp:Panel>
<atlasToolkit:DropShadowExtenderID="DropShadowExtender1"runat="server"EnableViewState="true">
<atlasToolkit:DropShadowPropertiesTargetControlID="Panel1"/>
</atlasToolkit:DropShadowExtender>
</div>

BTW) Why tagprefix is cc1 and not atlasToolkit (you have to manually change it)

From the DropShadowProperties.cs:

// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Permissive License.
// Seehttp://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.


using System.Web.UI.WebControls;
using System.Web.UI;
using System.ComponentModel;
using Microsoft.AtlasControlExtender;

namespace AtlasControlToolkit
{
public class DropShadowProperties : TargetControlPropertiesBase<Panel>
{

/// <summary>
/// The opacity of the shadow, from 0 (transparent - no shadow rendered) to 1.0, which is fully opaque black.
///The default is .5.
/// </summary>
[DefaultValue(1.0f)]<-- This is not default .5
public float Opacity
{
get
{
return GetPropertyValue<float>("Opacity", 1.0f);<-- This is not default .5
}
set
{
SetPropertyValue<float>("Opacity", value);
}
}


Yes, that's a documentation bug, thanks for pointing it out.

The tag prefixes are arbitrary. They default to "cc1" or whatever, there isn't any way to specify them automatically.

Thanks!


Oh - the ID field is marked Browsable(false) so it won't show up in intellisense.

It's not needed in the 90% case and you can get yourself in trouble (e.g. if you use it in a repeater) so it's hidden.

DropShadow does not like height:auto or width:auto?

This is causing an initialize argument error when used with panel using styles either height:auto or width:auto?Since auto is the default, can you simply remove the hight/width style declarations?