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))
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.
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 */} } }
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 != " ")) ...
In the VBA editor, put the following code in the "This Workbook" sheet: Private Sub Workbook_Open() MsgBox "I just opened my workbook" End Sub then save the workbook, close it, and open it again to see if this is what you want.
Given a group of radio buttons: <input type="radio" id="radio1" name="radioGroup" value="1"> <input type="radio" id="radio2" name="radioGroup" value="2"> You can test whether a specific one is checked using jQuery as follows: if ($("#radio1").prop("checked")) { // do something } // OR if ($("#radio1").is(":checked")) { // do something } // OR if you don't have ids set you can go by group name and value // (basically you need a selector that lets you specify the particular input) if ($("input[name='radioGroup'][value='1']").prop("checked"))
This code will crop the image based on all white and transparent pixels from around the image public static Bitmap CropWhiteSpace(Bitmap bmp) { int w = bmp.Width; int h = bmp.Height; int white = 0xffffff; Func allWhiteRow = r => { for (int i = 0; i allWhiteColumn = c => { for (int i = 0; i = 0; --row) { if (!allWhiteRow(row)) break; bottommost = row; } int leftmost = 0, rightmost = 0; for (int col = 0; col = 0; --col) { if (!allWhiteColumn(col)) break; rightmost = col; } if (rightmost == 0) rightmost = w; // As reached left if (bottommost == 0) bottommost = h; // As reached top. int croppedWidth = rightmost - leftmost; int croppedHeight = bottommost - topmost; if (croppedWidth == 0) // No border on left or right { leftmost = 0; croppedWidth = w; } if (croppedHeight == 0) // No border on top or bottom { topmost = 0; croppedHeight = h; } try { var target = new Bi...