Friday, 24 February 2012

get Hidden Field in Jquery

The following doesn't work for me to set the value of a hidden form field with FireFox 9:
Copy code
  1. <input type="hidden" name="hiddeninputname" value="" />
with
Copy code
  1. $('input[name=hiddeninputname]').val(theValue);

However, using style="display:none;" the following does work:
Copy code
  1. <input style="display:none;" id="hiddeninputid" name="hiddeninputname" value="" />
with
Copy code
  1. $('input[id=hiddeninputid]').val(theValue);
or
Copy code
  1. $('input[name=hiddeninputname]').val(theValue);

Friday, 17 February 2012

msg in asp.net


String scriptText = 
        "return confirm('Do you want to submit the page?')";
    ClientScript.RegisterOnSubmitStatement(this.GetType(), 
        "ConfirmSubmit", scriptText);

Friday, 3 February 2012

linq-case-statement

http://stackoverflow.com/questions/936028/linq-case-statement


http://www.vikramlakhotia.com/LINQ_to_SQL_and_Case_statement.aspx

list to string

using System;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
 // List of cities
 List<string> cities = new List<string>();
 cities.Add("New York");
 cities.Add("Mumbai");
 cities.Add("Berlin");
 cities.Add("Istanbul");

 // Join strings into one CSV line
 string line = string.Join(",", cities.ToArray());
 Console.WriteLine(line);
    }
}

get string[] from datatable

string[] columnNames = objDT.Columns.Cast<DataColumn>().Select(x => x.ColumnName).ToArray();