| Subcribe via RSS

GridView Export to Excel

June 26th, 2010 | 2 Comments | Posted in ASP.NET

protected void lnk1_Click(object sender, EventArgs e)

    {

   GridViewExportUtil.Export(Guid.NewGuid().ToString(“N”).Substring(0, 6) + “.xls”, this.GridView1);

    }

 

 

.CLASS

  More »

Datetime convert Only Time (MSSQL)

June 24th, 2010 | No Comments | Posted in SQL SERVER

SELECT
CONVERT(VARCHAR(8),GETDATE(),108) as HourMinuteSeconds

Ip Adress Web Service

June 19th, 2010 | 1 Comment | Posted in ASP.NET

Ip adres’i parametre olarak gönderiyoruz Kullanıcının İL ve Plaka gibi bilgilerinin xml olarak alıyoruz…

Çıktı: 78.177.2.252 OK TR Turkey 34 Istanbul Istanbul 41.0186 28.9647 0 0 0

System.Xml.Linq.XDocument doc = System.Xml.Linq.XDocument.Load(”http://ipinfodb.com/ip_query.php?ip=” + Context.Request.ServerVariables["REMOTE_ADDR"] + “”);

var kisiler = from p in doc.Elements(”Response”) select p;

string location = “”;

foreach (var item in kisiler)

{

location = item.Element(”City”) != null ? item.Element(”City”).Value : “”;

}

Mssql CharIndex Kullanımı

June 15th, 2010 | No Comments | Posted in SQL SERVER

Eğer ki @metin’in içinde Beşiktaş varsa sıfırdan farklı bir rakam, yoksa sıfır değeri dönücektir.

DECLARE @metin varchar(64)

SELECT @metin = ‘Küfüre karşıyız Biz Beşiktaşlıyız’ +

‘ Spor Dostluk Kardeşliktir’

SELECT CHARINDEX(’Beşiktaş’, @metin)

DatagridView Hit Cell Click showing Contextmenu

June 1st, 2010 | No Comments | Posted in C#

private void dataGridView1_MouseDown(object sender, MouseEventArgs e)

{

DataGridView.HitTestInfo hit = dataGridView1.HitTest(e.X, e.Y);

if (hit.RowIndex >= 0)

{

dataGridView1.ClearSelection();

dataGridView1.Rows[hit.RowIndex].Selected = true;

dataGridView1.ContextMenuStrip.Show(this.dataGridView1, new Point(e.X, e.Y));

}

}

Select into & insert into select (Msssql)

May 31st, 2010 | No Comments | Posted in SQL SERVER

Insert Into Select (Var olan tabloya bir başka tablodan insert)

insert into cutomerCopy (customername, customersurname)
select customername, customersurname from Customer

Select into (into’dan sonra yazılan tablo ismi verilen kolon isimlerine göre 0′dan oluşturulup yapılan insert)

select customername , customersurname into CustomerCopy

from customer

Color from hex string (ASP.Net)

May 29th, 2010 | No Comments | Posted in ASP.NET

Color.FromName(”#AED47D”);

c# string checked isnumber

May 29th, 2010 | No Comments | Posted in C#

int numero;

string valuto=”trying”;

bool isnum=int.TryParse(valuto, out numero);

int numero_return= isnum==true: valuto?0;

Gridview RowCommand getting Rowindex

May 27th, 2010 | No Comments | Posted in ASP.NET

protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)

{

if (e.CommandName == “Delete”)

{

GridViewRow row = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);

int index= row.RowIndex;

}

}

Datalist Itemcommand get datakeys value

May 27th, 2010 | No Comments | Posted in ASP.NET

protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)

{

if (e.CommandName==”Save”)

{

string datakeyvalue=        DataList1.DataKeys[e.Item.ItemIndex].ToString();

}

}