Logo 
Search:

Asp.net Forum

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds

Help w/ Design/Coding Tip

  Asked By: Carole    Date: Sep 09    Category: Asp.net    Views: 1020
  

I'm trying to find a slick way to do the following:

- query the database for several numeric values (select f1, f2,
f3... from table1 where...)
- convert them into a comma separated string ie.(4,2,9,4,4,10,1800)
- assign the string to the value of a radio button control
- update seven labels with each of the numbers when the radio button
is clicked (this needs to be done on the client side)

I could do this by concatenating all of the values with a loop, then
use a similar loop on the client side and use the innertext??
property of the labels. However, I'm hoping that there are some
neat string functions that would be able to help.

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Nicolas Costa     Answered On: Sep 09

In your query  return concatenated string:
select f1 + ',' + f2 + ... + f7 FROM ...
call ExecuteScalar
on client  side code execute:
var sNums = string_blah.Split(',');
document.formName.labelName1.value = sNums[0];
...
document.formName.labelName7.value = sNums[6];

 
Didn't find what you were looking for? Find more on Help w/ Design/Coding Tip Or get search suggestion and latest updates.




Tagged: