Concatenating values from a set of controls

vb.net , asp.net , visual studio 2008 Cairo, Egypt
  • 10 years ago
    Dears, i'm developing a web application to send SMS, my question is that i want to make a loop where it stops according to a counter which is stored in a hidden field, each time user clicks add more button to add more receipents , the counter is incremented and is stored in a hidden field named **hdn_counter** also there are hidden fields also which i store the phone numbers of receipients, here is my piece of code: Public Sub CheckHiddenValues() For i As Integer = 1 To hdn_Counter.Value Dim test As String test = (hdn_to & + i + ).value Next End Sub i need to concatenate the hidden field with the counter i where i have hdn_to1 and hdn_to2 and so on...etc could anyone help me doing the concatenation??
  • 10 years ago
    Hi Dalia - welcome to developerFusion! Unfortunately you can't reference controls in that way. How are you creating the controls in the first place? You might want to consider adding them to a list as you create them, for instance: List myDynamicControls... // instance variable ... Control dynamicAddedControl = new Control(); myDynamicControls.Add(dynamicAddedControl) Then you could simply iterate your list of controls to fetch the values. Hope that helps
  • 10 years ago
    Hi Dalia, can I only ask you why you are using these "hidden", and how (on customer-product or fruit-apple example). Maybe there is better mechanism instead "hidden fields"... i will try to find this if you show sense of hidden

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“An expert is a man who has made all the mistakes that can be made in a very narrow field” - Niels Bohr