views:

94

answers:

2

I work on Asp.Net vs08 C# .I want to show popup ** Bottom** of the button .Not on center of page.Here is my syntax .

Aspx code:

<input id="Button3" type="button" value="Open 1" />

Jquery:

<script type="text/javascript">
  $(function() {
      $("#Popup").dialog({
          bgiframe: true,
          autoOpen: false,
          height: 300,
          modal: true,
          buttons: {
              Cancel: function() {
                  $(this).dialog("close");
              }
          },
         close: function() {
              allFields.val("").removeClass("ui-state-error");
         }
      }).parent().appendTo($("form:first"));
      $("#Button3").click() {
        $("#Popup").dialog("open");
      });
    });
</script>

show me syntax or modify my syntax. Thanks.

A: 

You'll need to add a position field to your options argument:

<script type="text/javascript">
  $(function() {
      $("#Popup").dialog({
          bgiframe: true,
          autoOpen: false,
          height: 300,
          modal: true,
          position: [100, 200], // 100 is x location, 200 is y location, in pixels
          buttons: {
              Cancel: function() {
                  $(this).dialog("close");
              }
          },
         close: function() {
              allFields.val("").removeClass("ui-state-error");
         }
      }).parent().appendTo($("form:first"));
      $("#Button3").click() {
        $("#Popup").dialog("open");
      });
    });
</script>

position can also accept a string like "top" or "left".

See the jQuery UI Dialog documentation for more information about this.

TM
Thanks .But i want to set position dynamically .How to set position of popup left of the button control,your given syntax position: [100, 200], not solve my problem.
@user280048 rather than setting `[100,200]`, just pass in some position that you calculate...
TM
A: 

Just add the Position keyword to your query like

position: [400, 500]

Nasser Hadjloo
Thanks .But i want to set position dynamically .How to set position of popup left of the button control,your given syntax position: [100, 200], not solve my problem.