Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
30
Getting a textbox value in a user control in a web tab
posted

Here is my issue.....

 

I have an aspx page that has a button on it named save....

I also have  an ultraWebTab control that has three tabs.  In each of those tabs is a user control.  On those user controls I have various textboxes, listboxes, etc.

 Here is some code that loads fourtext boxes with values when the page loads.

'These get each of the three tabs in the ultra web tab control
Dim tabGeneral As Infragistics.WebUI.UltraWebTab.Tab = Me.uwtProperties.Tabs.FromKey("General")
Dim tabProduct As Infragistics.WebUI.UltraWebTab.Tab = Me.uwtProperties.Tabs.FromKey("ProductInfo")
Dim tabOther As Infragistics.WebUI.UltraWebTab.Tab = Me.uwtProperties.Tabs.FromKey("Other")

'This sets each of the four textboxes with some values
CType
(tabGeneral.FindControl("tbDocumentName"), System.Web.UI.WebControls.TextBox).Text = oDocInfo.Name
CType(tabGeneral.FindControl("tbDocOwner"), System.Web.UI.WebControls.TextBox).Text = oDocInfo.OwnerFullName
CType(tabGeneral.FindControl("tbDocOwnerIDSID"), System.Web.UI.WebControls.TextBox).Text = oDocInfo.Owner
CType(tabGeneral.FindControl("tbComments"), System.Web.UI.WebControls.TextBox).Text = oDDMSWS.GetCustomAttribute(oDocInfo, "log_entry")

 This works just fine.  :)

Now the issue.  When I change a value in a text box and click the save button there is a postback and I try to get the value of the text box.  I am getting A value but not my CHANGED value.  In other words, when I first set the textbox (tbDocumentName) to say "Test Document".  Then, I change it in the UI to "My New Improved Test Document" and click the SAVE button, I get the original value ("Test Document") not the new value ("My New Improved Test Document")

 Here is the code I use on the save button click event.

'These get each of the three tabs in the ultra web tab control
Dim tabGeneral As Infragistics.WebUI.UltraWebTab.Tab = Me.uwtProperties.Tabs.FromKey("General")
Dim tabProduct As Infragistics.WebUI.UltraWebTab.Tab = Me.uwtProperties.Tabs.FromKey("ProductInfo")
Dim tabOther As Infragistics.WebUI.UltraWebTab.Tab = Me.uwtProperties.Tabs.FromKey("Other")

'This is returning the original value instead of the change that I made
oDocInfo.Name =
CType(tabGeneral.FindControl("tbDocumentName"), System.Web.UI.WebControls.TextBox).Text.ToString

Any help would be appreciated. 

Thanks in advance.

  • 28464
    posted

    Hello, 

    I believe this might be a page-lifecyle issue - at the moment of checking (Load) the new text is not yet set for the textbox, because change events happens after load.

    I can suggest subscribing to the OnTextChanged event of the TextBox and getting the new value from the event handler.

    Example:

    <asp:TextBox runat="server" ID="TextBox1" OnTextChanged="TextChanged" />