Sunday, January 30, 2011

Get Date Only from DateTime

Simple Conversion to nvarchar can be used to get only Date part from date and time string like

SELECT CONVERT(NVARCHAR(10),GETDATE(),120)

Friday, January 28, 2011

Iterating a RadGrid view in silver light

private void Button1_Click(object sender, RoutedEventArgs e)


{

foreach(Player player in this.playersGrid.Items)

{

var row = this.playersGrid.ItemContainerGenerator.ContainerFromItem(player) as GridViewRow;

if(row.IsSelected)

{

//you may implement your custom logic here.

}

}

}

or we can use it at GridDatabound event  like

protected void RadGrid1_DataBound(object sender, EventArgs e)


{

foreach (GridDataItem item in RadGrid1.MasterTableView.Items)

{

bool oneValue = Convert.ToBoolean(item.GetDataKeyValue("status").ToString());

CheckBox chk = (CheckBox)item.FindControl("MyCheckBox");

chk.Checked = oneValue;

}

}

Friday, January 21, 2011

Add mime type for silverlight in iis


If .xap mime type is not registered on iis it can be added by using the following path in mime type add dialogue
application/x-silverlight-app

and using .xap extenstion in