-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: MysticAspen
Message 1 in Discussion
Hi Guys Im writing a simple web user control for telephone number. I get Ambigious
error when i run my aspx page. Why is it so ? TIA Srivats ================
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
namespace csTelephone
{
/// <summary>
/// Custom Control for TelePhone Number
/// </summary>
public class Tele : System.Web.UI.WebControls.WebControl
{
//private string m_id="";
private string m_class="";
private string m_name="";
private string m_phonenumber="";
TextBox txtOne=new TextBox();
TextBox txtTwo=new TextBox();
TextBox txtThree=new TextBox();
Label lblName=new Label();
/// <summary>
/// Override the base method to create the Controls
/// </summary>
protected override void CreateChildControls()
{
txtOne.MaxLength=3;
txtTwo.MaxLength=3;
txtThree.MaxLength=4;
//Set the Width of the TextBoxes
txtOne.Width=30;
txtTwo.Width=30;
txtThree.Width=35;
//Add the Controls
Controls.Add(lblName);
Controls.Add(new LiteralControl(" "));
Controls.Add(txtOne);
Controls.Add(new LiteralControl("-"));
Controls.Add(txtTwo);
Controls.Add(new LiteralControl("-"));
Controls.Add(txtThree);
}
/// <summary>
/// Set the Phone Number to the Control
/// </summary>
public string phonenumber
{
get
{
EnsureChildControls();
return m_phonenumber;
}
set
{
EnsureChildControls();
m_phonenumber=value;
ArrangePhoneNumber();
}
}
private void ArrangePhoneNumber()
{
char [] sep={'-'};
string [] Numbers=m_phonenumber.Split(sep);
txtOne.Text=Numbers[0];
txtTwo.Text=Numbers[1];
txtThree.Text=Numbers[2];
}
/// <summary>
/// Set the name for the Label
/// </summary>
public string name
{
get
{
EnsureChildControls();
return m_name;
}
set
{
EnsureChildControls();
m_name=value;
}
}
/// <summary>
/// Set the Class for the Control
/// </summary>
public string customclass
{
get
{ EnsureChildControls();
return m_class;
}
set
{ EnsureChildControls();
m_class=value;
}
}
/// <summary>
/// Render this control to the output parameter specified.
/// </summary>
/// <param name="output"> The HTML writer to write out to </param>
protected override void Render(HtmlTextWriter output)
{
base.Render(output);
}
}
}
=========
This is what i have in ASPX Page
<%@ Register TagPrefix="tele" Namespace="csTelePhone" Assembly="csTelePhone" %><%@
Register TagPrefix="tele" Namespace="csTelePhone" Assembly="csTelePhone" %>
<tele:Tele id="Tele1" name="Tel.No" customclass="inputbox"
phonenumber="123-456-7890" runat="server"></tele:Tele>
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]