Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating custom properties
Message
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Client-side développement
Titre:
Creating custom properties
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01335677
Message ID:
01335677
Vues:
47
Hi everybody,

Do you know how can I add a custom property to a control?

Here is the code I'm trying
protected void Page_Load(object sender, EventArgs e)
    {
        string sConnString = ConfigurationManager.ConnectionStrings["FCCMSConnectionString"].ConnectionString;
        SqlConnection oCn = new SqlConnection(sConnString);

        SqlCommand Command = new SqlCommand("GetSchoolsBySiteID", oCn);
        Command.CommandType = CommandType.StoredProcedure;

        SqlParameter ParSiteID = new SqlParameter("@SiteID", this.GetParameter());
        
        Command.Parameters.Add(ParSiteID);
        
        Command.Connection.Open();

        SqlDataReader oReader = Command.ExecuteReader();
        
        while (oReader.Read())
        {
         ListItem li = new ListItem();
           li.Attributes.Add("Phone", oReader["Phone"].ToString()) ;
           li.Text = oReader["School"].ToString() ; 
           li.Value = li.Text;
           this.ddlSchool.Items.Add(li);   
        }
        oReader.Close();
        oCn.Close();
        this.ddlSchool.Attributes.Add("onchange","alert( this.options[this.selectedIndex].Phone);");  
    }
However, JavaScript shows undefined all the time. Do you see what's wrong here or how can I create a new custom property and access it?

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform