4
Answers

Need learning sites of HTML5, CSS3 and Javascript

Parth Dave

Parth Dave

9y
528
1
 
Which are the best learning sites of HTML5, CSS3 and Javascript for intermediate or advanced level ?
 
Please tell me apart from W3schools.com.
Answers (4)
0
Praneeth Kumar

Praneeth Kumar

NA 832 43.4k 13y
I assume you are putting checked items inside an array or list. so your code should be like below
string query;
if(checkedcount==1)
{

query="select "+checkedvalue[0]+" from tablename";
}
else
{
StringBuilder columns=new StringBuilder();
        for(int i=0;i<checkedValues.Length;i++)
        {
                if(i<checkedValues.Length-1)
                {
                        columns.Append(checkedValues[i]);
                        columns.Append(",");
                
                }
                else
                {
                    // No more commas needed as this is last column
                        columns.Append(checkedValue[i]);
                }

          }

query="select "+columns+" from tablename";
}

execute ur query.

I hope this query helps..This is just a rough code snippet.
Accepted
0
Suthish Nair

Suthish Nair

NA 38.4k 4.6m 13y
So request you accept all three methods as Answers. This will helpful for others also.
0
Murali krishna  Ande

Murali krishna Ande

NA 43 39.2k 13y
Thanks for your valuable suggestions guys....

Problem solved..

Once again thanks
Murali Krishna

0
Suthish Nair

Suthish Nair

NA 38.4k 4.6m 13y

 try...

 

 -- To get all checked items from Checkboxlist using LINQ
 using System.Collections.Generic;
 using System.Linq;

 IEnumerable<string> allCheckedValues = chboxlist.Items
.Cast<ListItem>()
.Where(item => item.Selected)
.Select(item => item.Value);

 String ss = "";
 foreach (var item in allChecked)
 {
   ss = (ss == "" ? "[" + item + "]" : ss + ", [" + item + "]");
 }

 String query1 = String.Format("Select {0} from {1}", ss, "Table1");

 If not want to use LINQ, then use for each to loop the checkbox list.

0
Muralidharan Deenathayalan

Muralidharan Deenathayalan

NA 21.9k 1.5m 13y


 

  private void btn_Click(object sender, EventArgs e)
        {
             string s = "select ";

            for (int i=0;i<checkedListBox1.CheckedItems.Count;i++)
            {
                 if (checkedListBox1.CheckedItems.Count > i)
                     if (checkedListBox1.CheckedItems.Count-1 == i)
                     {
                         s += checkedListBox1.Items[i].ToString() ;
                     }
                     else
                     {
                         s += checkedListBox1.Items[i].ToString() + " , ";
                     }
            }

            label1.Text = s;
        }



Try this.