473,395 Members | 1,986 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,395 software developers and data experts.

How to Create Web Controls using ASP.NET Controls ?

Hello All,

I am trying to write Web Controls and in most of the samples I came across,
I am seeing the following function where a HTML string is written to create
HTML Controls.
/// <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)

{

string TheHTMLString = FrameHTMLString() ;

output.Write(TheHTMLString) ;

}
Is it possible for me to use the asp:button or asp:panel in this webcontrol.
Also how will I setup events for such button click or panel mouse down
event?
Any suggestions please?

Thanks
Aand Ganesh


Nov 19 '05 #1
3 1484
These articles should give you a jump start in learning about how to create
web controls:

http://SteveOrr.net/articles/InheritAndExtend.aspx
http://SteveOrr.net/articles/ComboBox.aspx
http://SteveOrr.net/articles/BarGraphs.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"msnews.microsoft.com" <ag*****@nobel-systems.com> wrote in message
news:ux**************@TK2MSFTNGP09.phx.gbl...
Hello All,

I am trying to write Web Controls and in most of the samples I came
across, I am seeing the following function where a HTML string is written
to create HTML Controls.
/// <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)

{

string TheHTMLString = FrameHTMLString() ;

output.Write(TheHTMLString) ;

}
Is it possible for me to use the asp:button or asp:panel in this
webcontrol. Also how will I setup events for such button click or panel
mouse down event?
Any suggestions please?

Thanks
Aand Ganesh

Nov 19 '05 #2
Steve,

Thanks for the quick help.

Regards
Anand

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:uT**************@TK2MSFTNGP15.phx.gbl...
These articles should give you a jump start in learning about how to
create web controls:

http://SteveOrr.net/articles/InheritAndExtend.aspx
http://SteveOrr.net/articles/ComboBox.aspx
http://SteveOrr.net/articles/BarGraphs.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"msnews.microsoft.com" <ag*****@nobel-systems.com> wrote in message
news:ux**************@TK2MSFTNGP09.phx.gbl...
Hello All,

I am trying to write Web Controls and in most of the samples I came
across, I am seeing the following function where a HTML string is written
to create HTML Controls.
/// <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)

{

string TheHTMLString = FrameHTMLString() ;

output.Write(TheHTMLString) ;

}
Is it possible for me to use the asp:button or asp:panel in this
webcontrol. Also how will I setup events for such button click or panel
mouse down event?
Any suggestions please?

Thanks
Aand Ganesh


Nov 19 '05 #3
Steve,

I saw your sample and also I created my control based on your combobox
sample.

But my page is not even showing up the control.

Can you please let me know what I am missing?

Thanks
Anand

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

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


}

}



///////////// My code ////////////

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:uT**************@TK2MSFTNGP15.phx.gbl...
These articles should give you a jump start in learning about how to
create web controls:

http://SteveOrr.net/articles/InheritAndExtend.aspx
http://SteveOrr.net/articles/ComboBox.aspx
http://SteveOrr.net/articles/BarGraphs.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"msnews.microsoft.com" <ag*****@nobel-systems.com> wrote in message
news:ux**************@TK2MSFTNGP09.phx.gbl...
Hello All,

I am trying to write Web Controls and in most of the samples I came
across, I am seeing the following function where a HTML string is written
to create HTML Controls.
/// <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)

{

string TheHTMLString = FrameHTMLString() ;

output.Write(TheHTMLString) ;

}
Is it possible for me to use the asp:button or asp:panel in this
webcontrol. Also how will I setup events for such button click or panel
mouse down event?
Any suggestions please?

Thanks
Aand Ganesh


Nov 19 '05 #4

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

Similar topics

7
by: Bil Muh | last post by:
Esteemede Developers, I would like to Thank All of You in advance for your sincere guidances. I am developing a software using Visual C++ .NET Standard Edition with Windows Form (.NET)...
3
by: Kiyomi | last post by:
Hello, I create a Table1 dynamically at run time, and at the same time, I would like to create LinkButton controls, also dynamically, and insert them into each line in my Table1. I would...
3
by: DB | last post by:
Hi Folks, I want to create Activex component. Can we create it using c#.net or do I need to create it using vc++? Thanks in Advanced, Deepak
1
by: MaryamSh | last post by:
Hi, I am creating a Dynamic Search in my application. I create a user control and in Page_load event I create a dynamic dropdownlist and 2 dynamic button (Add,Remove) By pressing Add button...
0
by: MaryamSh | last post by:
Create Dynamic Dropdownlist Controls and related event -------------------------------------------------------------------------------- Hi, I am creating a Dynamic Search in my application. I...
15
by: lxyone | last post by:
Using a flat file containing table names, fields, values whats the best way of creating html pages? I want control over the html pages ie 1. layout 2. what data to show 3. what controls to...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.