Showing posts with label table. Show all posts
Showing posts with label table. Show all posts

Wednesday, March 28, 2012

Dynamic CollapsiblePanel

I am surely a novice, but was wondering if it is possible to dynamically build a page of collapsible panels based on the values in a SQL table. The code size would be greatly reduced if it can be done.Just another forum that noone uses!

I'll be honest, this is a very vague question. And it seems as though you are fishing for free code. We aren't here to code projects for you. If you are looking for pointers, I'll gladly provide this.

The approach I would take is to use either a SqlDataSource or ObjectDataSource to retrieve the data. I like working with objects, so it tends to take more code up front to get the data from SQL and turn it into objects in my object model. But once done, I then use the ObjectDataSource to get the data ready for binding.

Then you can use any number of databound controls. One example might be the Repeater control. This is a very free form control that will let you provide any HTML per object (or row) returned from the datasource. In the ItemTemplate, you just define the CollapsiblePanelExtender as you would in any databound control.

If you get stuck, please post here with the code that is blocking you and I'll do what I can to help.


Got it working. The problem was with the page sub-class.

Monday, March 26, 2012

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 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

Saturday, March 24, 2012

DropShadow Resize problem with the Shadow remaining on table resize.

The code below is just a sample I added to the DropShadow and I pretty sure this is a bug.

What happens when load up is fine. When you move items from the left listbox to the right listbox it seems fine.

EXCEPT, when one listbox becomes empty, the listbox shrinks, hence the table shrinks and then your left with this big black shadow on the right that goes up to the table. That is the shadow has not resized with the table.

If I addWidth="100%" to the Panel yes it works but then my screen design is not what I want I have this massive table on the screen. It's the solution I'm forced to use now.

<divclass="demoarea">

<divclass="demoheading">DropShadow Demonstration</div><asp:PanelID="Panel1"runat="server"CssClass="dropShadowPanel"Width="100%"><divstyle="padding:10px">

<tableborder="2"width="100%">

<tr>

<tdcolspan="3"align=center> </td>

</

tr>

<

tr><td>

<asp:ListBoxRows="20"SelectionMode="Multiple"ID="lbListLeft"runat="server"><asp:ListItem>Somewhere RSL Club, 555 Something St, Somewhere</asp:ListItem><asp:ListItem>20</asp:ListItem>

<asp:ListItem>D</asp:ListItem></asp:ListBox><br/></td><td><NOBR><inputvalue="Add >>" type="button"BR></NOBR><NOBR><inputvalue="Add <<" type="button"BR></NOBR><NOBR><inputvalue="Add All >>" type="button"BR></NOBR><NOBR><inputvalue="Add All <<" type="button"BR></NOBR></td><td>

<br/><asp:ListBoxRows="20"SelectionMode="Multiple"ID="lbListRight"runat="server"><asp:ListItem> RSL Club, 154 Somewhere Pde, Somewhere</asp:ListItem><asp:ListItem>2</asp:ListItem><asp:ListItem>3</asp:ListItem>

</asp:ListBox></td>

</

tr>

</

table>

Did you set "TrackPosition='true'" on the DropShadowProperties?


Yes I haveTrackPosition="true"as it came from the example.

Here's the complete code in a master page. YOu'll notice that once you move all items to one listbox the table shrinks I have mentioned. I've done some slight changing to the html but this content page should work standalone. Unless you tweak the Content Placer then you'll have to tweak the javascript.

<%

@.PageLanguage="C#"MasterPageFile="~/Site.master"AutoEventWireup="true"CodeFile="DropShadow.aspx.cs"Inherits="DropShadow_DropShadow"Title="DropShadow Sample" %>

<%

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

<

asp:ContentID="Content1"ContentPlaceHolderID="MiddleContent"Runat="Server"><atlas:ScriptManagerid="ScriptManager"EnablePartialRendering="true"runat="Server"/><divclass="demoarea"><asp:PanelID="Panel1"runat="server"CssClass="dropShadowPanel"><divstyle="padding:10px">

<

tableborder="0"width="100%">

<tr><td><tableborder=0width="100%">

<tr><tdalign="right"><asp:ListBoxRows="20"SelectionMode="Multiple"ID="lbListLeft"runat="server"><asp:ListItem>Kogarah RSL Club, 254 Railway Pde, Kogarah</asp:ListItem><asp:ListItem>20</asp:ListItem><asp:ListItem>30</asp:ListItem><asp:ListItem>40</asp:ListItem><asp:ListItem>A</asp:ListItem><asp:ListItem>B</asp:ListItem><asp:ListItem>C</asp:ListItem><asp:ListItem>D</asp:ListItem></asp:ListBox></td></tr></table><br/><br/></td><td><NOBR><inputvalue="Add >>"onclick="moveDualList( this.form.ctl00$MiddleContent$lbListLeft, this.form.ctl00$MiddleContent$lbListRight, false );"type="button"style="width:90"><BR></NOBR><NOBR><inputvalue="Add <<"onclick="moveDualList( this.form.ctl00$MiddleContent$lbListRight, this.form.ctl00$MiddleContent$lbListLeft, false );"type="button"style="width:90"><BR></NOBR><NOBR><inputvalue="Add All >>"onclick="moveDualList( this.form.ctl00$MiddleContent$lbListLeft, this.form.ctl00$MiddleContent$lbListRight, true );"type="button"style="width:90"><BR></NOBR><NOBR><inputvalue="Add All <<"onclick="moveDualList( this.form.ctl00$MiddleContent$lbListRight, this.form.ctl00$MiddleContent$lbListLeft, true );"type="button"style="width:90"><BR></NOBR></td><td>

<br/>

<br/><asp:ListBoxRows="20"SelectionMode="Multiple"ID="lbListRight"runat="server"><asp:ListItem> RSL Club, 154 Railway Pde, Kogarah</asp:ListItem><asp:ListItem>2</asp:ListItem><asp:ListItem>3</asp:ListItem><asp:ListItem>4</asp:ListItem><asp:ListItem>5</asp:ListItem><asp:ListItem>D</asp:ListItem><asp:ListItem>G</asp:ListItem><asp:ListItem>K</asp:ListItem><asp:ListItem>Z</asp:ListItem><asp:ListItem>55</asp:ListItem></asp:ListBox></td>

</

tr>

<

tr><tdcolspan=3align=center><asp:ButtonID="btnSave"Text="Save"runat=server/></td></tr>

<

tr><tdcolspan=3>

</

td></tr>

</

table>

<

br/><br/><hr/><p><asp:PanelID="CollapseHeader"runat="server"style="cursor: pointer;"width="100%"><asp:LabelID="Label1"runat="server"Text="Label">Show Details...</asp:Label></asp:Panel><asp:PanelID="Panel2"runat="server"style="overflow:hidden;height:0"width="100%">

Not many details here. This is just a demo to show how the DropShadow will react properly to changes in the size of the panel it is attached to.

</asp:Panel><atlasToolkit:CollapsiblePanelExtenderID="cpe1"runat="server"><atlasToolkit:CollapsiblePanelPropertiesTargetControlID="Panel2"Collapsed="true"CollapsedText="Show Details..."ExpandedText="Hide Details"TextLabelID="Label1"ExpandControlID="CollapseHeader"CollapseControlID="CollapseHeader"SuppressPostBack="true"/></atlasToolkit:CollapsiblePanelExtender></p></div></asp:Panel><divclass="demobottom"></div></div><atlasToolkit:DropShadowExtenderID="dse"runat="server"><atlasToolkit:DropShadowPropertiesTargetControlID="Panel1"Width="5"Rounded='true'Opacity=".75"TrackPosition="true"ID="dsBehavior"/></atlasToolkit:DropShadowExtender>

<

SCRIPTLANGUAGE="JavaScript">

<!-- Begin

// Compare two options within a list by VALUES

function

compareOptionValues(a, b)

{

// Radix 10: for numeric values, Radix 36: for alphanumeric valuesvar sA = parseInt( a.value, 36 );var sB = parseInt( b.value, 36 );return sA - sB;

}

// Compare two options within a list by TEXT

function

compareOptionText(a, b)

{

// Radix 10: for numeric values, Radix 36: for alphanumeric valuesvar sA = parseInt( a.text, 36 );var sB = parseInt( b.text, 36 );return sA - sB;

}

// Dual list move function

function

moveDualList( srcList, destList, moveAll )

{

// Do nothing if nothing is selectedif (( srcList.selectedIndex == -1 ) && ( moveAll ==false ))

{

return;

}

newDestList =

new Array( destList.options.length );var len = 0;for( len = 0; len < destList.options.length; len++ )

{

if ( destList.options[ len ] !=null )

{

newDestList[ len ] =

new Option( destList.options[ len ].text, destList.options[ len ].value, destList.options[ len ].defaultSelected, destList.options[ len ].selected );

}

}

for(var i = 0; i < srcList.options.length; i++ )

{

if ( srcList.options[i] !=null && ( srcList.options[i].selected ==true || moveAll ) )

{

// Statements to perform if option is selected, Incorporate into new list

newDestList[ len ] =

new Option( srcList.options[i].text, srcList.options[i].value, srcList.options[i].defaultSelected, srcList.options[i].selected );

len++;

}

}

// Sort out the new destination list

newDestList.sort( compareOptionValues );

// BY VALUES//newDestList.sort( compareOptionText ); // BY TEXT// Populate the destination with the items from the new arrayfor (var j = 0; j < newDestList.length; j++ )

{

if ( newDestList[ j ] !=null ) destList.options[ j ] = newDestList[ j ];

}

// Erase source list selected elementsfor(var i = srcList.options.length - 1; i >= 0; i-- )

{

if ( srcList.options[i] !=null && ( srcList.options[i].selected ==true || moveAll ) )

{

// Erase Source//srcList.options[i].value = ""; srcList.options[i].text = "";

srcList.options[i] =

null;

}

}

}

// End -->

</

script>

</asp:Content>

Wednesday, March 21, 2012

DropDownExtender breaks table in Firefox

Hi!

I'm using the DropDownExtender over a tablerow.
It's working ok in IE7 but not in Firefox.

All columns get merged into the first one when the DropDownExtender is created.
I'm using the latest release (Feb 01)
Here's an example

<%

@dotnet.itags.org.PageLanguage="C#"AutoEventWireup="true"CodeFile="Default.aspx.cs"Inherits="_Default" %>

<!

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>Untitled Page</title><styletype="text/css">.ContextMenuPanel

{

border:1pxsolid#868686;z-index:1000;background:url(pics/menu-bg.gif)repeat-y00#FAFAFA;cursor:default;padding:1px1px0px1px;font-size:11px;

}

.ContextMenuBreak

{

margin:1px1px1px32px;padding:0;height:1px;overflow:hidden;display:block;border-top:1pxsolid#C5C5C5;

}

a.ContextMenuItem

{

border:0;margin:1px01px0;display:block;color:#003399;text-decoration:none;cursor:pointer;padding:4px19px4px33px;white-space:nowrap;

}

a.ContextMenuItem-Selected

{

font-weight:bold;

}

a.ContextMenuItem:hover

{

background-color:#FFE6A0;color:#003399;border:1pxsolid#D2B47A;padding:3px18px3px32px;

}

</style>

</

head>

<

body><formid="form1"runat="server"><asp:ScriptManagerID="ScriptManager1"runat="server"/><asp:UpdatePanelID="updatePanel"runat="server"><ContentTemplate><asp:PanelID="DropPanel"runat="server"CssClass="ContextMenuPanel"Style="display :none; visibility: hidden;"><asp:LinkButtonrunat="server"ID="Option1"Text="Option 1"CssClass="ContextMenuItem"/><asp:LinkButtonrunat="server"ID="Option2"Text="Option 2"CssClass="ContextMenuItem"/><asp:LinkButtonrunat="server"ID="Option3"Text="Option 3 (Click Me!)"CssClass="ContextMenuItem"/></asp:Panel><ajaxToolkit:DropDownExtenderrunat="server"ID="DDE1"TargetControlID="row2"DropDownControlID="DropPanel"/><asp:TableID="table"runat="server"Border="1"><asp:TableHeaderRowID="row1"><asp:TableHeaderCell>Column 1</asp:TableHeaderCell><asp:TableHeaderCell>Column 2</asp:TableHeaderCell><asp:TableHeaderCell>Column 3</asp:TableHeaderCell><asp:TableHeaderCell>Column 4</asp:TableHeaderCell></asp:TableHeaderRow><asp:TableRowID="row2"><asp:TableCell>Value 1</asp:TableCell><asp:TableCell>Value 2</asp:TableCell><asp:TableCell>Value 3</asp:TableCell><asp:TableCell>Value 4</asp:TableCell></asp:TableRow><asp:TableRowID="row3"><asp:TableCell>Test 1</asp:TableCell><asp:TableCell>Test 2</asp:TableCell><asp:TableCell>Test 3</asp:TableCell><asp:TableCell>Test 4</asp:TableCell></asp:TableRow></asp:Table></ContentTemplate></asp:UpdatePanel><div></div></form>

</

body>

</

html>

Does anyone know why this is happening?

/Mathias

Same exact issue here.