473,396 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Please Help - New in Creating WEB CONTROLS

Hello All,

I created a control and it is not showing up in my Web Page?

I am new to this. Can somebody please explain what I am doing wrong.

Thanks
Anand Ganesh

Here is my control code. Below this code I have posted my Main Code which is
accessing this control.
/// WEB CONTROL CODE
using System;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.ComponentModel;

using System.Collections ;

namespace NobelSystemsControls

{

public class WebControlPickOneValue : System.Web.UI.WebControls.WebControl

{

ArrayList ListofAllValues = new ArrayList() ;

string SelectedValueName = "" ;

int SelectedIndex = -1 ;

public void PerformHandShake(ArrayList InList)

{

this.ListofAllValues = InList ;

}
/// <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)

{

}

protected override void CreateChildControls()

{

ListBox TheListBox = new ListBox() ;

foreach(string eachst in this.ListofAllValues)

{

TheListBox.Items.Add(eachst) ;

}

TheListBox.SelectedIndexChanged +=new
EventHandler(TheListBox_SelectedIndexChanged);

this.Controls.Add(TheListBox) ;

//base.CreateChildControls ();

}

private void TheListBox_SelectedIndexChanged(object sender, EventArgs e)

{

ListBox INListBox = (ListBox) sender ;

this.SelectedValueName = INListBox.SelectedItem.ToString() ;

this.SelectedIndex = INListBox.SelectedIndex ;

}

}

}

/// The MAIN Code calling the CONTROL

using System;

using System.Collections;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Web;

using System.Web.SessionState;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.HtmlControls;

namespace WebApplication

{

/// <summary>

/// Summary description for WebForm1.

/// </summary>

public class WebForm1 : System.Web.UI.Page

{

protected NobelSystemsControls.WebControlPickOneValue
WebControlPickOneValue1;
private void Page_Load(object sender, System.EventArgs e)

{

// Put user code to initialize the page here

ArrayList ToGo = new ArrayList() ;

ToGo.Add("0") ;

ToGo.Add("1") ;

ToGo.Add("2") ;

ToGo.Add("3") ;

ToGo.Add("4") ;

ToGo.Add("5") ;

ToGo.Add("6") ;

ToGo.Add("7") ;

ToGo.Add("8") ;

ToGo.Add("9") ;

ToGo.Add("10") ;

this.WebControlPickOneValue1.PerformHandShake(ToGo ) ;

}

#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);

}
/// <summary>

/// 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


}

}


Nov 19 '05 #1
0 827

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application...
1
by: suzy | last post by:
hi, i have created a aspx page template by creating a template.cs file which inherits from the page class. In this file I override the OnInit event and create a template in the form of a...
13
by: Lloyd Sheen | last post by:
I have now spent 5 hours on google/msdn looking for something useful in the creation of user controls for asp.net. The VS 2003 has very limited support for things such as absolute positioning of...
1
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a...
0
by: imranabdulaziz | last post by:
Hi all, I am using asp.net and C# Visual studio 2005. Let me explain the scenario. I have stored procedure which return very no of column based on condition. Becoz I have to show columnwise...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.