losing data

L

Lloyd Dupont

On my web page I have a custom control developed in a C# library.
Somehow when I post the page, the user input disappears.
I override OnLoad() and check the value of my inputText.Text just before and
after base.OnLoad() and the user entered text never even seems to reach my
TextBox, although the ID property looks alright, and consistent.

Any tips on how to investigate this bug? or what could be the cause of it?
 
L

Lloyd Dupont

Really weird...
I have setup an event listener to the Load event of my text box and its Text
propert is still ""
although I have also checked Context.Request.Params[tTitle.UniqueID] and it
does contains the user value....
how comes my TextBox's Text is not updated?
Any ideas?
 
L

Lloyd Dupont

err...
Allright...
The proble is with Comment.tTitle, it's always empty. Also my event hadler
DoSomething is never called.
And nowhere I'm writing tTitle.Text = "";, so how could it be?

something like that:
=== MyPage.aspx ===
........
<my:MyControl runat=server />
==MyControl.cs ==
class MyControl : Control, INamingContainer
{
Entry entry;
Comment comments;
protected override void CreateChildControls()
{
base.CreateChildControls();
Controls.Add(entry = new Entry());
ControlsAdd(comments = new Comment());
}
.......
}
== Entry.cs ==
class Entry : Control, INamingContainer
{
.....
}
== Comment.cs ==
class Comment : Control, INamingContainer
{
TextBox tTitle;
Button submit;
protected override void CreateChildControls()
{
base.CreateChildControls();
Controls.Add(tTitle = new TextBox());
tTitle.ID = "tTitle";

RequiredFieldValidator rfv = new RequiredFieldValidator();
rfv.ErrorMessage = "Required";
rfv.ControlToValidate = "tTitle";
Controls.Add(tTitle);

Controls.Add(submit = new Button());
submit.Text = submit;
submit.Clik += DoSomething();
......
}
void DoSomething(object sender, EventArgs e)
{
....
}
}
=============
 
L

Lloyd Dupont

Found it, I add some control without ID and that was, somehow, causing the
problem....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top