Welcome Guest Search | Active Topics | Sign In | Register

Dialog position in web custom control with custom id's Options
eplaksienko
Posted: Wednesday, October 31, 2007 7:32:03 AM
Rank: Newbie
Groups: Member

Joined: 5/30/2007
Posts: 8
I am trying to make dialog to show near the anchor using AnchorElementID and ShowDirection parameters in custom web control but it still appears in the center

this is control code

<%@ Control Language="c#" AutoEventWireup="false" Codebehind="ContentDialogHelpControl.ascx.cs" Inherits="tripapp.RU.GUI.ContentDialogHelpControl" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<%@ Register TagPrefix="eo" NameSpace="EO.Web" Assembly="EO.Web" %>
<eo:Dialog runat="server" id="hD" ControlSkinID="None" Width="300px" Height="200px" HeaderHtml="Dialog Header"
BorderStyle="Solid" CloseButtonUrl="00070101" MinimizeButtonUrl="00070102"
BorderWidth="1px" ShadowColor="LightGray" BorderColor="#335C88" RestoreButtonUrl="00070103"
ShadowDepth="3" ResizeImageUrl="00020014">
<HeaderStyleActive CssText="padding-right: 4px; padding-left: 4px; font-size: 11px; background-image: url(00070104); padding-bottom: 3px; padding-top: 3px; font-family: tahoma"></HeaderStyleActive>
<ContentStyleActive CssText="border-top: #335c88 1px solid; background-color: #e5f1fd"></ContentStyleActive>
</eo:Dialog>
<a id="hl1" runat=server>Show Dialog</a>


this is c# code

namespace tripapp.RU.GUI
{
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

/// <summary>
/// Summary description for ContentDialogHelpControl.
/// </summary>
public abstract class ContentDialogHelpControl : System.Web.UI.UserControl
{
protected EO.Web.Dialog hD;
protected System.Web.UI.HtmlControls.HtmlAnchor hl1;
protected System.Web.UI.HtmlControls.HtmlGenericControl div1;

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
string itemid="helpDialog_" + place + "_" + header;
hl1.ID="helpLink_" + place + "_" + header;
//div1.ID="helpDiv_" + place + "_" + header;
hl1.HRef="javascript:eo_GetObject('" + itemid + "').show(true);";
hD.ID=itemid;
//hD.ConfineElementID="helpDiv_" + place + "_" + header;
//hD.ConfineElementID="div1";
hD.AnchorElementID="helpLink_" + place + "_" + header;
hD.ShowDirection=EO.Web.ExpandDirection.Auto;

hD.HeaderHtml=header;
hD.ContentHtml=itemid;
}

protected string place="";
protected string header="";

public string Place
{
set
{
place=value;
}
}

public string Header
{
set
{
header=value;
}
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
eo_support
Posted: Wednesday, October 31, 2007 7:44:14 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

That occurs when the dialog can not find the AnchorElementID. Try call document.getElementById(your_anchor_element_id) and see if you get an object or null. If it returns null, then the ID is wrong.

Thanks
eplaksienko
Posted: Wednesday, October 31, 2007 8:23:19 AM
Rank: Newbie
Groups: Member

Joined: 5/30/2007
Posts: 8
Found solution by myself
easy and effisient

//hD.AnchorElementID="helpLink_" + place + "_" + header;

hD.AnchorElementID=this.ClientID+"_helpLink_" + place + "_" + header;

One word, I changed it to server control identifier generated by ASP.NET
eplaksienko
Posted: Wednesday, October 31, 2007 8:24:09 AM
Rank: Newbie
Groups: Member

Joined: 5/30/2007
Posts: 8
Anyway, thanks for fast reply


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.