M
Mike Lerch
Wow, I hope someone has a moment to help, because I'm losing my mind.
I want to present the user with a page of information, let them edit
it, and post the changes back to the database. I've got some
textboxes as part of the main form and a repeater control, each bound
to a different table in the dataset (the main form to the parent, the
repeater to the child records, sort of an Order / Details thing)
Everything involving GETTING the data is working fine: based on the
querystring, two data adapters fill one dataset with the info. The
textboxes that are just sitting there on the form are like this:
<asp:textbox id=tbCustomerFirstName runat="server"
Text='<%# DataBinder.Eval(dsParentData,
"Tables[Order].DefaultView.[0].CustomerFirstName") %>'>
</asp:textbox>
And again, they fill with data fine with these two lines in void
Page_Load:
daOrders.SelectCommand.Parameters["@OrderNumber"].Value =
Request.QueryString["OrderNumber"];
daOrders.Fill(dsParentData, "Order");
Page.DataBind();
The problem is when I try evaluate what has changed in the textbox to
post it back to the database.
I've tried a couple ways. I've attached a TextChanged event and
stepped through the code. When I evaluate this.tbCustomerFirstName,
it shows up as an empty string even if I've typed stuff into the
textbox!!! How could this be?
I've also tried just forcing the issue with a button that has code
like this:
DataTable dtCurrent;
dtCurrent = dsParentData.Tables["Order"];
DataRow drCurrent = dtCurrent.Rows[0];
drCurrent.BeginEdit();
drCurrent["CustomerFirstName"] = this.tbCustomerFirstName.Text;
//No reason to go lower than here, because
//this.tbCustomerFirstName.Text evaluates
//to "" even if I've typed something in.
drCurrent.EndEdit();
daOrders.Update(dsParentData, "Order")
Hope this isn't too long or too narrative but would really appreciate
the answer: why is the Text property coming up blank even when stuff
is typed in?
Lerch
I want to present the user with a page of information, let them edit
it, and post the changes back to the database. I've got some
textboxes as part of the main form and a repeater control, each bound
to a different table in the dataset (the main form to the parent, the
repeater to the child records, sort of an Order / Details thing)
Everything involving GETTING the data is working fine: based on the
querystring, two data adapters fill one dataset with the info. The
textboxes that are just sitting there on the form are like this:
<asp:textbox id=tbCustomerFirstName runat="server"
Text='<%# DataBinder.Eval(dsParentData,
"Tables[Order].DefaultView.[0].CustomerFirstName") %>'>
</asp:textbox>
And again, they fill with data fine with these two lines in void
Page_Load:
daOrders.SelectCommand.Parameters["@OrderNumber"].Value =
Request.QueryString["OrderNumber"];
daOrders.Fill(dsParentData, "Order");
Page.DataBind();
The problem is when I try evaluate what has changed in the textbox to
post it back to the database.
I've tried a couple ways. I've attached a TextChanged event and
stepped through the code. When I evaluate this.tbCustomerFirstName,
it shows up as an empty string even if I've typed stuff into the
textbox!!! How could this be?
I've also tried just forcing the issue with a button that has code
like this:
DataTable dtCurrent;
dtCurrent = dsParentData.Tables["Order"];
DataRow drCurrent = dtCurrent.Rows[0];
drCurrent.BeginEdit();
drCurrent["CustomerFirstName"] = this.tbCustomerFirstName.Text;
//No reason to go lower than here, because
//this.tbCustomerFirstName.Text evaluates
//to "" even if I've typed something in.
drCurrent.EndEdit();
daOrders.Update(dsParentData, "Order")
Hope this isn't too long or too narrative but would really appreciate
the answer: why is the Text property coming up blank even when stuff
is typed in?
Lerch