Skip to content

Infragistics Community Forum / Web / Ultimate UI for ASP.NET Web Forms / Height and width does not set from code behind.

Height and width does not set from code behind.

New Discussion
Mypost
Mypost asked on Aug 10, 2011 2:48 PM

Hi,

I am using webdialog window initially webdialogWindow state is hidden,

and also visible property set to false.

And i have two buttons, on click these buttons i open the Window.

when user clicked on first button then i am setting the window

height and width and also window visible property true, then it show  the window

in propert height and width as expected.

but after thet i click on 2nd button and set different height and width then it does not take

show window in specified height and width. why?

if initially i do not set window visible property false . then it works as expected.

 

Sign In to post a reply

Replies

  • 0
    [Infragistics] Viktor Snezhko
    [Infragistics] Viktor Snezhko answered on Aug 9, 2011 6:55 PM

    Hi,

    I tested following sample and it works as expected. If I click 200×200 button, then dialog appears with size 200×200. If I click 300×300 button, then dialog appears with size 200×200. If you have different configuration which fails, then please provide a simple sample to reproduce. Short codes you may paste directly, otherwise it is better to zip files and attach within Options tab.

    aspx:

        <ig:WebDialogWindow ID="WebDialogWindow1" runat="server" Height="250px"
       Visible="False" Width="350px" WindowState="Hidden"></ig:WebDialogWindow>
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click"
       Text="200×200" />
      <asp:Button ID="Button2" runat="server" onclick="Button2_Click"
       Text="300×300" />

    aspx.cs:

      protected void Button1_Click(object sender, EventArgs e)
      {
       this.WebDialogWindow1.WindowState = Infragistics.Web.UI.LayoutControls.DialogWindowState.Normal;
       this.WebDialogWindow1.Visible = true;
       this.WebDialogWindow1.Width = Unit.Pixel(200);
       this.WebDialogWindow1.Height = Unit.Pixel(200);
      }
      protected void Button2_Click(object sender, EventArgs e)
      {
       this.WebDialogWindow1.WindowState = Infragistics.Web.UI.LayoutControls.DialogWindowState.Normal;
       this.WebDialogWindow1.Visible = true;
       this.WebDialogWindow1.Width = Unit.Pixel(300);
       this.WebDialogWindow1.Height = Unit.Pixel(300);
      }

    Regards,
    Viktor

    • 0
      Mypost
      Mypost answered on Aug 10, 2011 8:15 AM

      i am doing same as you suggest, but there is one diffrance

      My WebDialogWIndow is within the UpdatePanel.

       

      • 0
        [Infragistics] Viktor Snezhko
        [Infragistics] Viktor Snezhko answered on Aug 10, 2011 2:48 PM

        Hi,

        I think I know what happens.
        If application has only one instance of control with Visible=false and Visible=true is set within async postback, then that means that that control is created on client within async response. If that control depends on javascript and css resources, then those resources are passed to the client also within async response. And that outcome maybe unpredictable and heavily depends on specific browser. Browser may fail to load resources or load them with delay before initialization script is executed. If that happens, then logic of control which calculates and sets size of html elements may fail or produce wrong results.

        To get around that situation, application may try to do one of the following:

        1. Add to application permanent dummy resource-loader: invisible instance of dialog outside of UpdatePanels:
        <ig:WebDialogWindow ID="dummyDialog" runat="server" WindowState="Hidden"></ig:WebDialogWindow>

        2. Load resources used by control (at least css) manually:

        <html xmlns="http://www.w3.org/1999/xhtml">
        <head runat="server">
           <title></title>
           <link href="ig_res/Default/ig_shared.css" type="text/css" rel="stylesheet" />
           <link href="ig_res/Default/ig_dialogwindow.css" type="text/css" rel="stylesheet" />
        </head>
        <body>
            <form id="form1" runat="server">

        To obtain exact values for href of links, application may temporary move control (WebDialogWindow) outside of UpdatePanel, run page, look at source of generated html and find those links.

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Mypost
Favorites
0
Replies
3
Created On
Aug 10, 2011
Last Post
14 years, 6 months ago

Suggested Discussions

Created by

Created on

Aug 10, 2011 2:48 PM

Last activity on

Feb 19, 2026 7:36 AM