Hi Bob,
>
>I have an mmTextBox placed on a web form and have bound it to a business object column using the bindingsource and bindingsourcemember properties. I also have a button next to this control with the following event code:
>
>
>// Create a new trader profit record
> TraderprofitDefaults TPD = new TraderprofitDefaults(this.profitID, Convert.ToInt32(this.cboTrader.SelectedValue));
> this.oTraderProfit.NewEntity(TPD);
> if (mmSaveDataResult.RulesPassed == this.oTraderProfit.SaveEntity())
> {
> string nextScreen = "ProfitEditForm.aspx?profitID=" + this.profitID.ToString();
> mmMessageDisplay.DisplayMessage("System Confirmation", "Trader Allocation Record Successfully Saved",
> nextScreen, 3);
> }
>
>
>The code is to add a new row into the trader profit table. This table has three columns. The two referenced above as default values and the third the value in the mmTextBox that is entered by the user (before the button is clicked to add the row).
>
>My problem is that the value entered in the text box is lost each time I click the button as it reverts back to zero. Can anyone help me to explain what is happening here?
>
>Thanks in advance.
If the user is entering this value you don't want reset then you need to store it in a session for instance and reset it in the page_load on postback.
for instance in the button click event:
Session["myTextboxValue"] = mmTextBox1.Text;
Then in the page load test for if a postback or not and reset the value the user had,
if (IsPostBack)
mmTextBox1.Text = (string)Session["myTextboxValue"];
I hope that helps
Tim
Timothy Bryan