Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Recognizing textbox text change
Message
From
15/04/2005 15:48:43
Patty Solomon
Central Susquehanna Intermediate Unit
Milton, Pennsylvania, United States
 
 
To
All
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
Recognizing textbox text change
Environment versions
Environment:
C# 1.1
OS:
Windows XP SP2
Database:
MS SQL Server
Miscellaneous
Thread ID:
01005310
Message ID:
01005310
Views:
57
My goal is to select a zip code from a combobox (which contains zip, city and state), and update a separate city textbox and state combobox from the selected combobox entry. The user has the option to overwrite the city and/or state.

The code to place the default city and state into their respective objects is in the Leave of the combobox, and works fine. However, if I do not tab through the city and state objects before pressing the Save button, only the zip code change is saved. When I tab through these two textboxes, the changes to the city and state save ok.

Here's the code from the zip_leave:

if (!(this.zip.Value.ToString() == originalZip))
{
// Locate the City and State Columns & values
int cityIdx = this.zip.DisplayLayout.Bands[0].Columns.IndexOf("City");
int stateIdx = this.zip.DisplayLayout.Bands[0].Columns.IndexOf("State");
string cityName = this.zip.SelectedRow.Cells[cityIdx].Text.ToString();
string stateAbbrev = this.zip.SelectedRow.Cells[stateIdx].Text.ToString();

// Change the city & state only if different from combobox values
if (!(this.txtBl_City.Text.ToString() == cityName))
{
this.txtBl_City.Text = cityName;
}
if (!(this.cboBl_State.Text.ToString() == stateAbbrev))
{
this.cboBl_State.Text = stateAbbreviation;
}
}

The code from the btnSave_Enter:
private void zzButtonSave1_Enter(object sender, System.EventArgs e)
{
// Make sure the PrimaryBizObj is the Parent BizObj
this.PrimaryBizObj = (BLDG_BO)this.GetBizObj("BLDG_BO");
}

This form contains a tab control and on the second tab, child table information is available for updating. Whenever the second tab is activated, the PrimaryBizObj is changed. That's the reason for the above code.

It appears that the dataset is not aware of the changes to the city and state objects. Is there a way to programmatically tell the dataset that changes exist for these two fields? Or, is there a better approach to what I'm trying to do?

TIA -
Patty
Next
Reply
Map
View

Click here to load this message in the networking platform