CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP.NET - InMotion Framework

 Access a field in a grid

Print topic Send  topic

Author Message
AndyGB4

Posts: 122
Posted: 05/15/2013, 1:16 PM

Hi everyone,

I'm trying to access a field that is in a grid (with 4 to 5 records).

Name: itemQty
Grid Name: itemsForm

In a "Before Show" action of a different label in the grid, I need to access the "itemQty" value to calculate something, but because there are more than 1 "itemQty" textBoxes (1 on each record), how do I get the one from the same record as the label that's doing the event?

If I just go get it with:
itemsForm.GetControl<MTTextBox>("itemQty").Text
Then it only gives me the 1st occurence of the textbox in the whole grid. So it works for label on the first row, but it doesn't work for any other rows.

I've also tried putting in the ID of the TextBox from the HTML that had the GridName, TextBox Name and the {RowComponents:rowNumber} thing at the end which gives each control a number based on its row.

Can anybody help me out?
View profile  Send private message
cvboucher

Posts: 191
Posted: 05/17/2013, 2:44 AM

I once had to do something similar. When a user clicked on an Image Button in a row I needed to access a value in a textbox in that same row. I used the following (VB.Net) code.
Dim tb As MTTextBox = CType(sender, MTImageButton).Parent.FindControl("NameOfControl")

HTH,
Craig
View profile  Send private message
AndyGB4

Posts: 122
Posted: 05/17/2013, 11:54 AM

Yup! that was exactly it!

I ended up using this on the Button's On Click event:
MTTextBox itemQty = ((MTButton)sender).Parent.FindControl("itemQty") as MTTextBox; string quantity = itemQty.Text;

Thanks a lot Craig!
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.