Monday, January 19, 2009

डेट परसे इन sql

DateTime.Parse(Request["ctl00$ContentPlaceHolder1$GridView1$ctl0"+Rownum.ToString()+"$txt_date"], new CultureInfo("fr-FR", false));

Friday, January 16, 2009

Using DropDownList control in DataGrid

http://www.csharphelp.com/archives/archive212.html

GridView add multiple controls to edit item template


Text='<%# Bind("project") %>'>
OnClick="LinkButton3_Click">PV

Reading values from Gridview Item Templates

//write this coding in gridview1_RowUpdating event // Read the values from Text Box String name = ((TextBox)(gridview1.Rows[e.RowIndex].FindControl("NAME"))).Text; //Read the values from Label String ID = ((Label)(dgSummary.Rows[e.RowIndex].FindControl("ID"))).Text; //Read Html Check Box value boolean bol=((HtmlInputCheckBox)(gridview1.Rows[e.RowIndex].FindControl("CheckBox1"))).Checked

An API for Google Image Search

find the url listed below

http://www.codeproject.com/KB/IP/google_image_search_api.aspx

Upload any type of File through a C# Web Service

http://www.c-sharpcorner.com/UploadFile/scottlysle/UploadwithCSharpWS05032007121259PM/UploadwithCSharpWS.aspx

Get Values from CheckBoxList

String values = "";
for (int i=0; i< cbl.Items.Count; i++)
{
if(cbl.Items[i].Selected)
{
values += cbl.Items[i].Value + ",";
}
}

values = values.TrimEnd(',');

How to get the Content Type(MimeType) of a file

private string MimeType (string Filename)
{
string mime = "application/octetstream";
string ext = System.IO.Path.GetExtension(Filename).ToLower();
Microsoft.Win32.RegistryKey rk = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(ext);
if (rk != null && rk.GetValue("Content Type") != null)
mime = rk.GetValue("Content Type").ToString();
return mime;
}

Wednesday, January 14, 2009

displaying gridview row index number



<%# Container.DataItemIndex + 1 %>

Dropdown in Gridview in Asp.net









DataSource="<%# GetProjectDs() %>"
DataTextField="PROJECT_NAME"
DataValueField="PROJECT_ID"
SelectedIndex='<%# GetProjectSelectedIndex((int)DataBinder.Eval(Container.DataItem,"PROJECT_ID")) %>'
>







DataSource="<%# GetTaskDs() %>"
DataTextField="TASK_NAME"
DataValueField="TASK_ID"
SelectedIndex='<%# GetTaskSelectedIndex((int)DataBinder.Eval(Container.DataItem, "TASK_ID")) %>'
/>




pick date









,'view_time_sheet.aspx?action=delete')">Delete Task
  ,<%# Container.DataItemIndex + 2 %>)">Update Task