Posts

Showing posts from September, 2013

string contains in Jquery

Like this: if (str.indexOf("Yes") >= 0) Note that this is case-sensitive. If you want a case-insensitive search, you can write if (str.toLowerCase().indexOf("yes") >= 0) Or, if (/yes/i.test(str))

Operation must use an updateable query

One quite likely reason is that the user running the program doesn't have read-write access to the database file, especially if it is located in program files folder,make sure excel not mark as "Read Only" So check the directory and file permissions and moodify them if needed. You can also consider changing the location of the database file to another, more asily accessible folder.

Gridview RowDataBound - extract data from a field

Use DataItem of the GridViewRow instead of DataBinder.Eval to get the underlying datasource: protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow && e.Row.RowState == DataControlRowState.Edit)) { DataRow row = ((DataRowView)e.Row.DataItem).Row; String name = row.Field ("Name"); // OR name = row[1]; // String is a reference type, so you just need to compare with null if(name != null){/* do something */} } }

Changing the color of a row in a GridView in ASP.NET

Change the color of a row depending on whether the Doctor is Active or Inactive protected void grdview_RowDataBound(object sender, GridViewRowEventArgs e) { { if (e.Row.RowType == DataControlRowType.DataRow) { if ((string.IsNullOrEmpty(e.Row.Cells[3].Text) != true) || (e.Row.Cells[3].Text != " ")) { Char result = Convert.ToInt32(e.Row.Cells[3].Text); if (result == ‘Y’) e.Row.BackColor = System.Drawing.Color.Aqua; else if (result ==’N’) e.Row.BackColor = System.Drawing.Color.Cornsilk; } } } } Change the Color of the cells depending on the Value of a column protected void grd_RowDataBound(object sender, GridViewRowEventArgs e) { { if (e.Row.RowType == DataControlRowType.DataRow) { if ((string.IsNullOrEmpty(e.Row.Cells[3].Text) != true) || (e.Row.Cells[3].Text != " "))