By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,966 Members | 1,488 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,966 IT Pros & Developers. It's quick & easy.

Why does webform cannot get data?

P: n/a
Tom
Hi,

I built an aspx page with c#. There are many textbox and a
submit button. When I input data in form and click submit,
I saw their values are null in debug window.

I checked namespace is correct.

What is the potential bug in my program?

Thanks
Nov 18 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Hi,
I think there is some problems in Postback, can u check
the properties once again.

Regards
Mahesh ChandraMouli
-----Original Message-----
Hi,

I built an aspx page with c#. There are many textbox and asubmit button. When I input data in form and click submit,I saw their values are null in debug window.

I checked namespace is correct.

What is the potential bug in my program?

Thanks
.

Nov 18 '05 #2

P: n/a
Hello Tom,

Tom wrote:
I built an aspx page with c#. There are many textbox and a
submit button. When I input data in form and click submit,
I saw their values are null in debug window.


During which event do you check the values with the debugger ?
If you check the values in Page_Load, the textboxes will not
yet have the new value. They will not have the new value
before the TextBox_Change event. [ At least, if everything's working OK ]
Try checking the values in TextBox_Change or Button_Click.

Best regards,

Eric
Nov 18 '05 #3

P: n/a
Tom
Hi,

I added breakpoint in button and the insert method to pass
those parameters of textbox to sql.

There are 10 parameters, 3 of them can show values, others
are null.

I checked their properties and id, all are ok.

So, where should I check now?

thanks
Nov 18 '05 #4

P: n/a
Hello Tom,

Tom wrote:
I checked their properties and id, all are ok.
So, where should I check now?


Can you perhaps post the code ( aspx and aspx.cs/aspx.vb ) ?
If it is a lot, please remove the irrelevant parts, so the
code is just enough to reproduce the problem.

Best regards,

Eric
Nov 18 '05 #5

P: n/a
Tom
Hi Eric,

I have 2 classes. One is for user to register, get and set
user info. Another one is for user to add product info.

Both of them have static insert method. Insert user info
and product info respectively in 2 different classes.

It is the code of the cs file behind the aspx:

protected Web.User objOperator;

private void Page_Load(object sender, System.EventArgs e)
{
objOperator = (Web.User)Session["UserName"];

if(!IsPostBack)
{
this.Bind_New();
}
}

private void button_Click(object sender, System.EventArgs
e)
{
this.Insert_Data(objOperator);
}

I added breakpoint in button method, I saw that all data
can be passed from webform.

private void Insert_Data(Web.User objOperator)
{
try
{
Web.Product.Insert(
objOperator.UserID,
Int32.Parse(this.AreaID.SelectedItem.Value),
this.Addr.Text,
......
);
}
catch(Exception e)
{
Response.Write(e.Message);
}

I added breakpoint here. All webform data were null. It
said error in getting the values. And, it throws
FormatException. Web.Product.Insert method is a way to
insert web form data to DB through Stored Procedure.

But, I use the same way to do register page, but no error.

Can I pass the value in user object to product?

Anyway to narrow down the finding of the bug? I added
breakpoint in product class, but the program did not stop
to let me see their values.

What's wrong with my code?

Thanks for your advice.

Tom



Nov 18 '05 #6

P: n/a
Hello Tom,

Tom wrote:
Can I pass the value in user object to product?
I don't see any problems with that.
What's wrong with my code?


I don't see anything odd.
Can you perhaps also post the aspx file ?

Best regards,

Eric
Nov 18 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.