ラベル resizablecontrolextender の投稿を表示しています。 すべての投稿を表示
ラベル resizablecontrolextender の投稿を表示しています。 すべての投稿を表示

2012年3月28日水曜日

Resizable Modal Popups?

I'm trying to make a modal popup be resizable. I've tried to combine the ModalPopupExtender with the ResizableControlExtender. Both are associated with the same panel.

It kinda works, but not correctly. When the popup appears, the resize graphic shows up on the left hand corner of the panel. After I click on the resize graphic it then will expand to the size of the modal window. In addition if the contents of the panel have to scroll (as a result of the resizing) the scrollbars mess up the positioning of the resize graphic.

I also had to turn off the drop shadow since it was not resizing with the panel.

Gerry

I think this is a definite nice to have especially if the popup is has a lot of form controls and you would like people to resize and/or have scrolling turned on. Please open awork item for this and we look into fixing this. The solution may not be very straightforward given that you want it to have the dropshadow and the drag in addition to the resize so the modalpopup code itself may need to change. Thanks!


It should work just fine Without the drop shadow. You can hook up the resizable extender to the modal panel and get things working for you.

The drop-shadow is not important to me. I will go ahead and enter the item.

Thanks,
Gerry


I haven't used the modal popup yet but I suspect that it is much like the popup extender. To get the shadow to stick with the control I had to add another panel that contained the popup container panel. I then hooked the resizable extender to that outer panel.

Again I haven't attempted it yet with modal. Here is a link to the code in the forum where I posted my solution.

http://forums.asp.net/t/1082450.aspx

Larry Aultman


I was not able to make the resizable extender work with the ModalPopup extender. I am sure that the source code could be modified to make it work however there is another solution that works very well and yields the same results: a drag-able, resizable, popup modal dialog. I am providing all the code below. You will need an "overlay" image that will provide the user screen "gray-out" effect. You also need very specific CSS styles and then you need the aspx and codebehind. I have included all source necessary, except the overlay.png file.

In my experience, most of the time that I would need a modal popup I need to get something that is bound for the server. Rarely do I need a popup that collects information when it isn't sent back. So this version's purpose is to collect data in a modal popup and send it all back to the server where the magic is done. Rather than use complex javascript to raise events back to the server I chose to use the extenders to handle the display and use AJAX update panels to handle the server. It all works very smoothly. I get the slick action of the client side and the AJAX posting.

Larry Aultman

I created my overlay.png file using Microsoft Expression. Very easy, make a new document with a size of say 32x32 pixels. Use the rectangle tool and draw a box removing the border and filling it with a soft color. I used a color that works well with my website. In the properties window set the Opacity to 50 (which is 50% transparent). Then export the image in PNG format. Drop this into your project folder. In the style sheet you will see my reference to the "overlay.png". NOTE: paths to files are relative to the style sheet's location NOT to the root of the site. I suggest that you put your style sheet in the root until you get everything working. Then you can move things around.

Next create a new aspx page with a codebehind page defined. Add a link in the "head" section to your style sheet something like:

<linkhref="pageStyles.css"rel="stylesheet"type="text/css"/>

Next place the following code in between the div tags in the new page.

<asp:scriptmanagerID="scriptmanager1"EnablePartialRendering="true"runat="server"></asp:scriptmanager>
<asp:UpdatePanelid="UpdatePanel1"runat="server">
<ContentTemplate>
<asp:ButtonID="btnShowDialog"runat="server"Text="Show Modal Popup"onclick="btnShowDialog_Click"/><br/>
<asp:LabelID="lbLoginMsg"runat="server"Text="User Not logged In"></asp:Label>
<divid="popupContainer1"class="popupContainer">
<asp:Panelid="popupPanel1"runat="server"Visible="false"CssClass="overlay">
<asp:Panelid="dragControl1"runat="server"CssClass="dragControl">
<asp:Panelid="popupClientArea1"runat="server"CssClass="popupClientArea">
<asp:Panelid="dragPanel1"runat="server"CssClass="dragMePanel">
<divid="dragMe1"class="dragMe"> Login </div>
</asp:Panel>
<asp:Panelid="popupContent1"runat="server"CssClass="popupContent">
<divid="popupBuffer1"class="popupBuffer">
User Name:<asp:TextBoxID="TextBox1"runat="server"></asp:TextBox><br/>
Password :<asp:TextBoxID="TextBox2"runat="server"></asp:TextBox><br/><br/>
<center>
<asp:ButtonID="btnLogin"runat="server"Text="Login"onclick="btnLogin_Click"/>
<asp:ButtonID="btnCancel"runat="server"Text="Cancel"onclick="btnCancel_Click"/>
</center>
</div>
</asp:Panel>
</asp:Panel>
</asp:Panel>
</asp:Panel>
<cc1:DragPanelExtenderid="DragPanelExtender1"runat="server"DragHandleID="dragPanel1"TargetControlID="dragControl1">
</cc1:DragPanelExtender>
<cc1:DropShadowExtenderid="DropShadowExtender1"runat="server"TargetControlID="popupClientArea1"Opacity="1"TrackPosition="True">
</cc1:DropShadowExtender>
<cc1:ResizableControlExtenderid="ResizableControlExtender1"runat="server"HandleCssClass="handleResizer"HandleOffsetX="2"HandleOffsetY="2"MinimumHeight="200"MinimumWidth="100"ResizableCssClass="resizingImage"TargetControlID="popupClientArea1">
</cc1:ResizableControlExtender>
</div>
</ContentTemplate>
</asp:UpdatePanel>

Now you need the codebehind:

protectedvoid Page_Load(object sender,EventArgs e)
{
this.ResizableControlExtender1.MinimumHeight = 200;//set inital size of the popup
this.ResizableControlExtender1.MinimumWidth = 300;//set inital size of the popup
}

protectedvoid btnShowDialog_Click(object sender,EventArgs e)
{
this.lbLoginMsg.Text ="User Not Logged In";
if (popupPanel1.Visible ==false)
popupPanel1.Visible =true;
}

protectedvoid btnCancel_Click(object sender,EventArgs e)
{
this.lbLoginMsg.Text ="User Canceled Login";
popupPanel1.Visible =false;
}

protectedvoid btnLogin_Click(object sender,EventArgs e)
{
this.lbLoginMsg.Text ="User: " + TextBox1.Text +" Password: " + TextBox2.Text;
popupPanel1.Visible =false;
}

Finally you need the CSS styles that make things happen.

/* Popup AJAX windows */

.popupControl

{

/*visibility:hidden;*/

}

.popupWin/* holds the entire popup window and its basic look.*/

{

background-color:Transparent;

font-family:"trebuchet MS",tahoma,verdana,arial,helvetica,sans-serif;

color:#838F86;

clear:both;

font-size:1em;

padding:10px;

height:50em;

width:50em;

min-width:20em;

min-height:20em;

}

.popupContainer/* holds the entire popup window and its basic look.*/

{

background-color:Transparent;

font-family:"trebuchet MS",tahoma,verdana,arial,helvetica,sans-serif;

color:#838F86;

clear:both;

float:left;

font-size:1em;

padding:10px;

height:50em;

width:50em;

min-width:20em;

min-height:20em;

}

.overlay

{

position:absolute;

left:0px;

top:0px;

width:100%;

height:100%;

text-align:center;

z-index:10;

background-image:url('images/overlay.png');/* relative to the style sheet file location */

background-repeat:repeat;

}

.dragControl

{

background-color:white;

z-index:100;

}

.popupClientArea/* provides the painting surface for the popup window */

{

background-color:#ffffff;

border:solid1px#445447;

overflow:hidden;

width:25em;

z-index:200;

}

.popupContent/* all content in the popup will be contained here */

{

background-color:Transparent;

overflow:auto;

text-align:left;

height:auto;

width:100%;

}

.popupBuffer/* this div provides a padding buffer from the edge so the content doesn't come flush with the edge */

{

padding:.3em;

}

.dragMePanel/* this provides the top edge that is the dragable area */

{

background-image:url('images/bg_nav.png');/* relative to the style sheet file location */

background-repeat:repeat-x;

cursor:move;

width:100%;

height:20px;

z-index:210;

}

.dragMe/* any text that might be shown in the drag area */

{

color:#ffffff;

text-align:center;

font-size:.8em;

font-family:"trebuchet MS",tahoma,verdana,arial,helvetica,sans-serif;

font-weight:normal;

}

.handleResizer

{

width:15px;

height:16px;

background-image:url('images/HandleHand.png');

overflow:hidden;

cursor:se-resize;

}

.resizingImage

{

border-style:solid;

border-width:2px;

border-color:#445447;

padding:0px;

}

ResizableControlExtender in CollapsiblePanelExtender

Hi,

I have a series of dynamically created controls, each with a ResizableControlExtender within a CollapsiblePanelExtender...and all is good until the time you come to collapse the panel.

At this point, the resize image of the ResizableControlExtender stays exactly where it was on the page and is visible above all other controls on the page. I have tried setting the z-index property on all affected controls to sort this out, but this has had no effect.

Can anyone suggest anything else I need to do to sort out this issue?

Has anybody seen this before?

If it helps, I am adding the ResizableControlExtender to a Panel which contains a TextBox in order to resize the TextBox.


Hi,

Can you show me a simple repro?

ResizableControlExtender Handle Click Event

I would like to be able to fire the event that occurs when the user clicks on the handle

ResizableControlExtender from my own javascript code.

Do you know how to do this?

Your help is much appreciated.

Thak you very much

Hi,

Internally, this extender doesn't support such behavior.

You may add an resizebegin event handler to the extender, in this handler, call a asynchronous method to invoke to method on server side( web service or pageMethod ) .

So, you code may goes like this:

function pageLoad()

{

var re = $find("behaviorID of the resizableExtender");

re.add_resizebegin(onResizeBegin);

}

function onResizeBegin()

{

//invoke a service side method here.

}

Hope this helps.

ResizableControlExtender does not resize image??

hi,

guys

ResizableControlExtender control does not resize the image.does this control not support the image control?

guide me.

thanks in advance.

Miss Sheetal,

Put your image control inside a panel and set the TargetControlID of ResizableControlExtender to the Panel's ID.


I've tried as u said,but it resizes panel not image!!!!!!!!! just check out this code:

<asp:Panel ID="panel1" BorderColor="black" BorderWidth="5" runat="server" Height="200">
<img id="img1" src="http://pics.10026.com/?src=images/untitled5.bmp" alt="sd" runat="server" />
</asp:Panel
<cc1:ResizableControlExtender ID="resiable" HandleCssClass="handleText" ResizableCssClass="resizingImage" HandleOffsetX="10" HandleOffsetY="20" runat="server" TargetControlID="panel1"></cc1:ResizableControlExtender>

<Script language="text/javascript">

.handleText
{
width:16px;
height:16px;
background-image:url(images/HandleGrip.png);
overflow:hidden;
cursor:se-resize;
}

.resizingImage
{
padding:0px;
border-style:solid;
border-width:3px;
border-color:#B4D35D;
}

</Script>


You have not specified the Client Side Javascripts that will actually resize the image. Watch thetutorial video on how to do that.


Thanks Buddy!!!!!!!!!!!!!

It Really helps me. Thanx for immediate reply.


Then please mark my previous post as the answer.

ResizableControlExtender and a MultiLine textbox

Can anyone give me the code for a resizableControlExtender that is used with a multiline textbox?
I don't know if it's because my brain hurts (more than usual) or what but I just can't get it to work.

Thanks!

Please refer to: http://forums.asp.net/t/1194380.aspx

ResizableControlExtender

I cannot get the ResizableControlExtender to work on a textbox multiline.
any help.........

I have also tried to put the text box in a panel & resize the panel. Only the panel resizes not the textbox

Hi U2envy1,

There's a wonderful sample contained in Ajax Control Toolkit. Here is the code section.

<asp:Panel ID="PanelText" runat="server" CssClass="frameText">
This text resizes itself to be as large as possible within its container.
</asp:Panel>

<ajaxToolkit:ResizableControlExtender ID="ResizableControlExtender2" runat="server"
TargetControlID="PanelText"
ResizableCssClass="resizingText"
HandleCssClass="handleText"
MinimumWidth="100"
MinimumHeight="50"
MaximumWidth="400"
MaximumHeight="150"
OnClientResize="OnClientResizeText" />

function OnClientResizeText(sender, eventArgs) {
// This sample code isn't very efficient, but demonstrates the idea well enough
var e = sender.get_element();
// Make the font bigger until it's too big
while((e.scrollWidth <= e.clientWidth) || (e.scrollHeight <= e.clientHeight)) {
e.style.fontSize = (fontSize++)+'pt';
}
var lastScrollWidth = -1;
var lastScrollHeight = -1;
// Make the font smaller until it's not too big - or the last change had no effect
// (for Opera where e.clientWidth and e.scrollWidth don't behave correctly)
while (((e.clientWidth < e.scrollWidth) || (e.clientHeight < e.scrollHeight)) &&
((Sys.Browser.agent !== Sys.Browser.Opera) || (e.scrollWidth != lastScrollWidth) || (e.scrollHeight != lastScrollHeight))) {
lastScrollWidth = e.scrollWidth;
lastScrollHeight = e.scrollHeight;
e.style.fontSize = (fontSize--)+'pt';
}
}

There's a little difference to what your want.You can use $get("<%=Your TextBox.ClientID%>").style.width= value to change its width property.

For more details , please dip into the source code.

Best regards,

Jonathan


Thanks much appreciated.
How do I do this ?

You can use $get("<%=Your TextBox.ClientID%>").style.width= value to change its width property.


Hi U3envy1,

I have found another solution which is better than the former. It will change the TextBox's width sostenuto while the former solution only changes its width after the resize operation. In this solution, we attached a Javascript function to the ResizableControlExtender's add_resizing event. The function will resize the TextBox according to the Panel's width.

Here is the whole sample which you can copy into your project.

<%@. 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"></script><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title> <style> .handleText { width:16px; height:16px; background-image:url(images/HandleGrip.png); overflow:hidden; cursor:se-resize; } .resizingText { padding:0px; border-style:solid; border-width:2px; border-color:#7391BA; } .frameText { width:100px; height:100px; overflow:auto; float:left; background-color:#ffffff; border-style:solid; border-width:2px; border-color:Gray; font-family:Helvetica; line-height:normal; } </style> </head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:Panel ID="Panel1" runat="server" CssClass="frameText"> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> </asp:Panel> <ajaxToolkit:ResizableControlExtender ID="ResizableControlExtender1" runat="server" TargetControlID="Panel1" BehaviorID="MyRCEBID" ResizableCssClass="resizingText" HandleCssClass="handleText" MinimumWidth="100" MinimumHeight="50" MaximumWidth="400" MaximumHeight="150" /> <script type="text/javascript" language="javascript"> var widht;function pageLoad(){ $find('MyRCEBID').add_resizing(onResizing); } function onResizing(){ width = $find('MyRCEBID').get_element().style.width; width = width.substring(0,width.length-2); width = width -10; width = width +'px'; $get("<%=TextBox1.ClientID%>").style.width = width; } </script> </form></body></html>

I really hope this help. Please pay special attention to the "Bold" Part.

Best regards,

Jonathan


Thanks much appreciated. I will try it soon. Just have so much to do at the moment. thanks again.


I had a chance to play with it. Its just what I wanted. Thanks its working beautifully.
How do I get the Textbox height to grow with the panel control?


Hi U2envy1,

$get("<%=TextBox1.ClientID%>").style.height = $find('MyRCEBID').get_element().style.height; Please have a try. By the way, you should modify the height property just like what we did on the width property.

Best regards,

Jonathan


Thanks once again.
One more thing about this. How do I get the font size to increase and decrease accordingly.


Hi U2envy1,

$get("<%=TextBox1.ClientID%>").style.fontSize = a certain value. Now , you should write your own arithmetic to work out value.

Best regards,

Jonathan


Hi,

I've done this and it works fine, except when I put it in a user control. When I do this, and use the resizable textbox more than once on the same page it gives me the error "Error: Sys.InvalidOperationException: Two components with the same id 'MyRCEBID' can't be added to the application".

So basically do I just need to change the "behaviorid" and the bit of javascript that references it to be something dynamically named? And if so, how might I go about this?

My code basically mirrors 'Jonathan Shen's' post


Hi Jonathan, I found code to work out the arithmetic value. how do I add this to the code you have provided already.

var fontSize = 12;

function OnClientResizeText(sender, eventArgs) {

// This sample code isn't very efficient, but demonstrates the idea well enough

var e = sender.get_element();

// Make the font bigger until it's too big

while((e.scrollWidth <= e.clientWidth) || (e.scrollHeight <= e.clientHeight)) {e.style.fontSize = (fontSize++)+'pt';

}

var lastScrollWidth = -1;

var lastScrollHeight = -1;

// Make the font smaller until it's not too big - or the last change had no effect

// (for Opera where e.clientWidth and e.scrollWidth don't behave correctly)

while (((e.clientWidth < e.scrollWidth) || (e.clientHeight < e.scrollHeight)) &&

((Sys.Browser.agent !== Sys.Browser.Opera) || (e.scrollWidth != lastScrollWidth) || (e.scrollHeight != lastScrollHeight))) {

lastScrollWidth = e.scrollWidth;

lastScrollHeight = e.scrollHeight;

e.style.fontSize = (fontSize--)+'pt';

}


Hi U2envy1,

I think you can add arithmetic code insideonResizing(){},sender.get_element() equal to $find('MyRCEBID').get_element(), you can replace it.

Hope this help.

Best regards,

Jonathan


I am lost when it comes to Java Script.
This is what I have so far. Any help on this. My font goes very small on resize thou. How do I increment it ?

var fontSize = 12;

function onResizing(){

width = $find('MyRCEBID').get_element().style.width;

width = width.substring(0,width.length-2);

width = width -10;

width = width +'px';height = $find('MyRCEBID').get_element().style.height;

height = height.substring(0,height.length-2);

height = height -10;

height = height +'px';

$get("<%=TextBox1.ClientID%>").style.width = width;

$get("<%=TextBox1.ClientID%>").style.height = height;

fontSize = $find('MyRCEBID').get_element().style.fontSize;fontSize = (fontSize++)+'pt';

$get("<%=TextBox1.ClientID%>").style.fontSize = fontSize;

}


Hi U2envy,

Here is the sample that I have expanded the reset text function.

<%@. 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"></script><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title> <style> .handleText { width:16px; height:16px; background-image:url(images/HandleGrip.png); overflow:hidden; cursor:se-resize; } .resizingText { padding:0px; border-style:solid; border-width:2px; border-color:#7391BA; } .frameText { width:100px; height:100px; overflow:auto; float:left; background-color:#ffffff; border-style:solid; border-width:2px; border-color:Gray; font-family:Helvetica; line-height:normal; } </style> </head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:Panel ID="Panel1" runat="server" CssClass="frameText"> <asp:TextBox ID="TextBox1" runat="server" value="hello"></asp:TextBox> </asp:Panel> <ajaxToolkit:ResizableControlExtender ID="ResizableControlExtender1" runat="server" TargetControlID="Panel1" BehaviorID="MyRCEBID" ResizableCssClass="resizingText" HandleCssClass="handleText" MinimumWidth="100" MinimumHeight="50" MaximumWidth="400" MaximumHeight="150" /> <script type="text/javascript" language="javascript"> var widht; function pageLoad(){ $find('MyRCEBID').add_resizing(onResizing); } var fontSize = 12; function onResizing(){ width = $find('MyRCEBID').get_element().style.width; width = width.substring(0,width.length-2); width = width -10; width = width +'px'; $get("<%=TextBox1.ClientID%>").style.width = width; $get("<%=TextBox1.ClientID%>").style.height = $find('MyRCEBID').get_element().style.height; e = $get("<%=TextBox1.ClientID%>"); // Make the font bigger until it's too big while((e.scrollWidth <= e.clientWidth) || (e.scrollHeight <= e.clientHeight)) { e.style.fontSize = (fontSize++)+'pt'; } var lastScrollWidth = -1; var lastScrollHeight = -1; // Make the font smaller until it's not too big - or the last change had no effect // (for Opera where e.clientWidth and e.scrollWidth don't behave correctly) while (((e.clientWidth < e.scrollWidth) || (e.clientHeight < e.scrollHeight)) && ((Sys.Browser.agent !== Sys.Browser.Opera) || (e.scrollWidth != lastScrollWidth) || (e.scrollHeight != lastScrollHeight))) { lastScrollWidth = e.scrollWidth; lastScrollHeight = e.scrollHeight; e.style.fontSize = (fontSize--)+'pt'; } }form></body></html>

fontSize = $find('MyRCEBID').get_element().style.fontSize get the Panel's fontSize instead of the TextBox's.

I hope this help.

Best regards,

Jonathan


Thanks much appreciated. I wish to add this code to every app I build. Ill comment it with inspired by Jonathan.
Thanks again...... !!!

ResizableControlExtender: Allowing only horizontal resizing

Hi; I have a ResizableControlExtender control in my page and I'd like to be able to resize it only in x direction (unlike the one in this forum input text control)

Thanks

Any relations to this code peace?:

<scripttype="text/javascript">
function OnClientClickGrow () {
var rcp = $find('ResizableControlBehavior1');
var size = rcp.get_Size();
rcp.set_Size( { width: size.width*2, height: size.height*2 } );
returnfalse;
}
</script>

Just set the ResizableControlExtender's MinimumHeight and MaximumHeight to the same value.

Joe


:) I've found out but u were faster :)

Thanks...

MinimumHeight="500" MaximumHeight="500"

ResizableControlExtender resize the vertical (height) only. EASY ONE!

Hey.. I got an easy one for yall..

I am using the resizablecontrolextender for a panel control. I want the client to have the ablility to resize the height of the box but NOT the width.

This works in Firefox, but not in IE 7 .. anyone got an idea? NO WIDTH!!

"ResizableControlExtender1" runat="server" TargetControlID="thePanel" MinimumWidth="-1" MaximumWidth="-1" MaximumHeight="400" MinimumHeight="100" HandleCssClass="handle" ResizableCssClass="onresize" HandleOffsetX="-300" >

Set MaximumWidth=MinimumWidth=200px (or whatever).

David Anson:

Set MaximumWidth=MinimumWidth=200px (or whatever).

Thatdoes work, but I want my resizable panel inside a div that expandshorizontally (liquid) with the window. The Control itself can beexpanded by the browser window size. An example would be like howoutlook separates emails (in a grid) above, and email details below.You can change the vertical size of the two boxes, but not make themsmaller than the window.

Essentially, I need the equivalent of minimumwidth="100%"


Since I really really want to figure this out I am providing an example to see if I can explain this problem better.

Here is a simple code example to illustrate:

<body>
<form id="form1" runat="server">
<style type="text/css">

.handle { background:Black; width:20px; height:20px; }

</style>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<div id="topDiv" runat="server" style="background:Blue; height:100px; display:block; width:100%;">
Content is in here.
</div
<div id="bottomDiv" runat="server" style="background:Red; height:200px;">
Some more content in here as well.
</div
<ajaxToolkit:ResizableControlExtender ID="extender" runat="server"
TargetControlID="topDiv"
HandleCssClass="handle"
MinimumHeight="100"
MaximumHeight="500">
</ajaxToolkit:ResizableControlExtender>

</form>
</body>
 
NOTICE: Both Divs expand to the size of the browser window. I just want to be able to resize the top Div without the ability to change the width. Ideas? Help! 

Since apparently this wasn't so easy I had to figure out a solution for myself. I thought I'd share:

<style type="text/css"> .topRow { overflow:hidden; display:block; background-color:#e6e6de; border:solid 1px black; } .innerTopRow { position:relative; top:0; left:0; right:0; bottom:0; height:93%; overflow:auto; } div.bottomRow { position:fixed; top:0px; bottom:0px; right:20px; left:212px; background:Green; overflow:auto; border:solid 1px black; } .handleTop { width:2000px; height:5px; background:#e6e6de; border-top:solid 1px black; border-bottom:solid 1px black; overflow:hidden; cursor:n-resize; } </style> <asp:ScriptManager ID="ScriptManager" runat="server" /> <asp:Panel id="topRowPanel" runat="server" CssClass="topRow"> <div class="innerTopRow"> <asp:ContentPlaceHolder ID="topRowContent" runat="server"></asp:ContentPlaceHolder> </div> </asp:Panel> <div ID="bottomRowPanel" class="bottomRow"> <asp:ContentPlaceHolder ID="bottomRowContent" runat="server"></asp:ContentPlaceHolder> </div> <script type="text/javascript"> function OnClientResizeText(sender, eventArgs) { var e = sender.get_element(); e.style.width = ''; $get("bottomRowPanel").style.top = e.clientHeight + 105; } </script> <ajaxToolkit:ResizableControlExtender ID="ResizableControlExtender" runat="server" TargetControlID="topRowPanel" HandleCssClass="handleTop" MinimumHeight="130" MinimumWidth="2000" MaximumWidth="2000" MaximumHeight="500" OnClientResizing="OnClientResizeText" HandleOffsetX="-1" />

ResizableControlExtender OnClientResize firing onload :-(

I have a ResizableControlExtender on my page. I set the OnClientResize to a js function with an alert. When I load the page, the alert pops. As expected, the alert pops on resize too, but I don't want the js function to be called on load. Is this a bug or expected behavior?

Thanks,

figz

Anyone?

To clarify (since it was Friday afternoon when I wrote the original post)...

Here is my ResizableControlExtender:

<ajaxToolkit:ResizableControlExtender ID="rceWrapper" runat="server" TargetControlID="panWrapper" HandleCssClass="handleWrapper"
MaximumHeight="0" MinimumWidth="960" BehaviorID="rceWrapper" OnClientResize="sayHello" />

Here is my js:

function sayHello(){alert('hello');}

The problem is when I load the page, the alert pops up. I would expect this to ONLY happen OnClientResize. So the question is, is this a bug or expected behavior? Thanks!


Hi Figz,

As far as I know, when the ResizableControlExtender control be initialized , it will call its _resizeControl(x, y, width,height) function. So that caused your problem.

To resolve this problem , my solution is to use a flag which will be set to true at pageLoad event. Just like this:

<script type="text/javascript" language="javascript">
var flag = false;
function pageLoad(){
flag = true;
}
function OnClientResizeText(sender, eventArgs) {
if(flag){
//your code;
}
}

</script>

Now , only when the flag is true , alert is allowed to be executed.

Another solution is attaching your javascript function on pageLoad event instead of defining as the ResizableControlExtender's property. Just like this.

<script type="text/javascript" language="javascript">
function pageLoad(){
$find('ResizableControlBehaviorID').add_resizing(OnClientResizeText)
}
function OnClientResizeText(sender, eventArgs) {
}

</script>

I hope this help.

Best regards,

Jonathan


Success! Thanks so much! For the record, I used the second option of attaching the js function on pageLoad instead of declaring it as a property. It worked like a charm!

Resize both panels at the same time with ResizableControlExtender

Hi;

Is it possible to resize two or more controls with the sameResizableControlExtender?

I mean just like in hotmail; when you enlarge left panel, right panel becomes automatically narrow

Thanks...

?


Hi,

You are actually referring to Splitter control, but as far as I know, this isn't available in AjaxControlToolkit yet( Please correct me if I'm wrong. ).

You may have to implement your own one or may try finding if there is any existing component.

Sorry for not being able to provide more help on this.


Thanks for your reply; u r right it's ain't there in AJAX v1;

I'll give a search for Splitter control cause theres no way to me to write mine own :D

Regards...


Actually I've found good examples here:

www.codeproject.com/useritems/VwdCmsSplitterBar.asp

Thanks...

Resizing the Ajax ResizableControlExtender durning the OnLoad event

I'm having a problem with the Ajax ResizableControlExtender.

The control is around an asp panel, which is around a gridview. The gridview is really wide, and I need the headers to stay at the top when scrolling down. That's working just fine.

I have a body onresize javascript event that resizes the ResizableControlExtender to fit better on the screen whenever the screen is resized.

What I need to do is have the resize event fire on the "OnLoad" event.

But at that time the ResizableControlExtender has not been initialized (or so I suppose) and is undefined at that time.

Is there a way to resize the ResizableControlExtender to the current window size in the page load event?

Thanks.

Chuck Snyder

Hi Chuck,

Based on my understanding, the pageLoad method is fired after all extenders on the page have been initialized. But if it doesn't work with you, please try to use window.setTimeout method to invoke the resize method in pageLoad, so that it will be called asynchronized at later.

For instance:

function pageLoad() { window.setTimeout(resize, 1000); }

2012年3月21日水曜日

RoundedCornersExtender and ResizableControlExtender together in IE

Hey all,

I am using both controls together for one panel. works fine in Mozilla, but in IE the hole panel seems to be positioned 20px down
and becomes a strange line on top.

Has anyone an idea what I am doing wrong?

Thanks in advance,

Pascal

Hi Pascal,

Perhaps you can post a code sample demonstrating what's going wrong. You should be able to get this to work if you're careful about the order in which you apply the extenders.

Thanks,
Ted