Posts

Showing posts from May, 2013

Remove cell's in gridview edit mode

This code is used for removing all cells except first cell(cell[0]). In   cell[0] we will display edit itemTemplate.                     GridView editGrid = sender as GridView;                     int colSpan = editGrid.Columns.Count;                     for (int i = 1; i < colSpan; i++)                     {                         e.Row.Cells[i].Visible = false;                         e.Row.Cells[i].Controls.Clear();                     }                     e.Row.Cells[0].Attributes["ColSpan"] = (colSpan).ToString();

Bind data in rowdatabound inside gridview based on row type

1).  if (e.Row.RowType == DataControlRowType.DataRow && !e.Row.RowState.ToString().Contains("Edit")) { } This is used for  Edit for Particular Row  inside gridview 2).  if (e.Row.RowType == DataControlRowType.DataRow && dgSmsTemplates.EditIndex == e.Row.RowIndex) { } This is used for  Edit for Particular index (loading Control like editor) inside gridview 3).    if (e.Row.RowType == DataControlRowType.DataRow) { } This is used for  Edit  inside gridview for perticular row (not binding values at runtime)

Sharepoint Tips

Response Redirect in a web part A:- Try going to Page.Response (or SPUtility.Redirect() indeed) System.Web.HttpContext.Current.Response.Redirect([URL Link]); SPUtility.Redirect("login.aspx", SPRedirectFlags.RelativeToLayoutsPage, HttpContext.Current); Getting the URL Query string values in a Web Part A:-the way to use this is Context.Request[string key name]ToString(); string kquery = Page.Request.QueryString[ "kqry" ]; New in SharePoint 2010 CAML Query <IN>,<INCLUDES> &< NOT INCLUDES> Even though Microsoft encourages using LINQ in SharePoint 2010, they introduced some new CAML Query schema elements. They are · IN · INCLUDES · NOT INCLUDES IN: This is something work as same as what we see in SQL Query. We can provide a collection of Items to filter. Previously in SharePoint 2007 we have to use OR operator to do this.. But using OR for multiple times for multiple values will lead to lack in code clarity. So IN operator is c