Ticket Q438457
Visible to All Users

ASPxGridView - How to get a value of ASPxTextBox placed in DataItemTemplate

created 12 years ago

Hi

Need some help with a asp gridview control this is the snippet from the gridview columns:

ASPx
<dx:GridViewDataTextColumn VisibleIndex="0" Name="Periode" Width="150px" Caption="Periode"> <DataItemTemplate> <dx:ASPxTextBox ID="periode" runat="server" Width="100%" Value='<%#Bind("Periode") %>'> </dx:ASPxTextBox> </DataItemTemplate> </dx:GridViewDataTextColumn> <dx:GridViewCommandColumn ButtonType="Button" VisibleIndex="1" Width="60px" Caption=""> <CustomButtons> <dx:GridViewCommandColumnCustomButton ID="cmdMakeBon" Text="Maak bon"> </dx:GridViewCommandColumnCustomButton> </CustomButtons> </dx:GridViewCommandColumn>

What I want is when the button is clicked check if the textbox 'periode' is empty if so show popupcontrol else perform calback and execute code with the row values.
I got this as javascript but i does not seem to work how can I get the value from the aspxtextbox?

JavaScript
<script type="text/javascript"> var rowVisibleIndex; function grid_CustomButtonClick(s, e) { if (e.buttonID != 'cmdMakeBon') return; rowVisibleIndex = e.visibleIndex; s.GetRowValues(e.visibleIndex, 'Periode',ShowPopup); } function ShowPopup(rowId) { popupControl.Show(); // btnYes.Focus(); } </script>

Answers

created 12 years ago (modified 12 years ago)

Hello;
The demonstrated approach allows you to obtain the value of a corresponding ASPxGridView cell. However, if a value typed in the ASPxTextBox has not been saved in a database, an old value will be returned.
If you wish to get the value of a corresponding ASPxTextBox on the client side, I believe that you can use a pure client-side solution. Please refer to the following example that demonstrates possible solutions for this task:
ASPxGridView - How to calculate column values on the client side via editors inside DataItemTemplate
How to sum values of bound and unbound columns and calculate a total value on the client side

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.