473,396 Members | 1,799 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.

try to create my own server control

I am trying to create my own server control "Tab"

So i have following classes

---------------------------------------------

public class TabsView : WebControl, INamingContainer
{
private TabPageCollection _tabs;
.....
}

public class TabPageCollection : ControlCollection
{...}

public class TabPage : WebControl, INamingContainer
{...}
---------------------------------------
Use

<cc1:TabsView ID="TabsView1" runat="server" >
<cc1:TabPage runat="server" ID="t1" TabName="T1">
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:Button ID="Button2" runat="server" Text="Click Me"
OnClick="Serverclick" />
</cc1:TabPage>
<cc1:TabPage runat="server" ID="t2" TabName="T2">
Test&nbsp;<br />
</cc1:TabPage>
</cc1:TabsView>
-------------------------------------------

Everything renders fine.
The problem i have with Postback. For whatever reason when i click Button2
POST happens but Serverclick is not called. Nor Textbox2 retains it value.

why is that?

thanks
George.
Mar 16 '07 #1
1 1042
Problem solved.
Do not use ControlCollection. It does not register controls with the page.
Write your own collection that will add controls to the Controls collection
when control is added by ASP.NET parser.

George.
"George Ter-Saakov" <gt****@cardone.comwrote in message
news:u2**************@TK2MSFTNGP06.phx.gbl...
>I am trying to create my own server control "Tab"

So i have following classes

---------------------------------------------

public class TabsView : WebControl, INamingContainer
{
private TabPageCollection _tabs;
....
}

public class TabPageCollection : ControlCollection
{...}

public class TabPage : WebControl, INamingContainer
{...}
---------------------------------------
Use

<cc1:TabsView ID="TabsView1" runat="server" >
<cc1:TabPage runat="server" ID="t1" TabName="T1">
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:Button ID="Button2" runat="server" Text="Click Me"
OnClick="Serverclick" />
</cc1:TabPage>
<cc1:TabPage runat="server" ID="t2" TabName="T2">
Test&nbsp;<br />
</cc1:TabPage>
</cc1:TabsView>
-------------------------------------------

Everything renders fine.
The problem i have with Postback. For whatever reason when i click Button2
POST happens but Serverclick is not called. Nor Textbox2 retains it value.

why is that?

thanks
George.

Mar 19 '07 #2

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)...
5
by: David Webb | last post by:
The problem started when the Working Folder for a project was somehow set to the folder of another project. I set the correct working folder in VSS and deleted the .vbproj files that had been...
2
by: strout | last post by:
It's a pain to create each button with 2 images: button_on.gif button_off.gif I am looking for a control that have on/off two states, preferred as BACKGROUND images and with button text on it. ...
0
by: SampathTangudu | last post by:
Hi, We are trying to use the Hash Tables for passing information from one aspx page to another aspx page. We are using the below code. IsolatedStorageFile isoStore =...
5
by: Angel | last post by:
Is there a way to create an IFRAME dynamically via VB.NET. In other words creating the HTML element in the server side code? thanks in advance....
6
by: JonSteng | last post by:
..Net Visual Studio Professional 2003 Version 7.1.3088 ..Net Framework 1.1 SP1 Version 1.1.4322 IIS 5.1 Windows XP Professional SP2 Micron T3000 Laptop (1.5 GHz; 1GB RAM; 40GB HD with 17GB Free)...
3
by: fyi85 | last post by:
I am trying to create a server on the same machine running the same instance. This is v8.1.5 on Windows 2003 Server. The instance is set to FEDERATED=YES The server will be created for database...
1
by: rushikesh.joshi | last post by:
Hi All, I want some charting functionality in my ASP.NET application. I want to show a multiple bar on my web page. It's based on down time of different servers. like server1: down betn 4 AM...
1
by: Allan Ebdrup | last post by:
I get the error: "Cannot create an object of type 'CustomWizard' from its string representation 'CustomWizard1' for the CustomWizard Property." when I view my custom server web control in...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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.