How to display ‘No data exists’ within the datagrid rather than just showing Column Headers with no rows

<asp:DataGrid id=’DataGrid1′ OnItemDataBound =’ItemDB’ runat=’server’></asp:DataGrid> VB.NET Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ’ Put user code to initialize the page here If Not Page.IsPostBack Then ’Populate the dataSet ’Bind the dataGrid with the dataView DataGrid1.DataSource = BindTheDataClass.Binddata().Tables(0).DefaultView DataGrid1.DataBind() End If End Sub ’Page_Load Protected Sub ItemDB(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Dim dv As DataView = CType(DataGrid1.DataSource, DataView) Dim drv As DataRowView = CType(e.Item.DataItem, DataRowView) If dv.Table.Rows.Count = 0 Then ’By default the Datagrid Header is shown in case there is no Data Available ’So in case of No Data found ’Check the ListItemType.Header If e.Item.ItemType = ListItemType.Header Then Dim i As Integer = e.Item.Cells.Count ’Assign ‘No Search result Found’ in one of the cells of DataGrid e.Item.Cells(0).Text = ‘No Search Results Found’ ’Remove Rest of the empty cells from Datagrid Dim j As Integer For j = i – 1 To 1 Step -1 e.Item.Cells.RemoveAt(j) Next End If End If End Sub ’ItemDB C# private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here if (!Page.IsPostBack ) { //Fill DataSet //Bind the DataGrid with the DataView DataGrid1.DataSource =ds.Tables[0].DefaultView ; DataGrid1.DataBind (); } } protected void ItemDB(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { DataView dv =(DataView)DataGrid1.DataSource ; DataRowView drv = (DataRowView)e.Item.DataItem ; if (dv.Table.Rows.Count == 0 ) { //By default the Datagrid Header is shown in case there is no Data Available //So in case of No Data found //Check the ListItemType.Header if ((e.Item.ItemType == ListItemType.Header)) { int i= e.Item.Cells.Count; //Assign ‘No Search result Found’ in one of the cells of DataGrid e.Item.Cells [0].Text = ‘No Search Results Found’; //Remove Rest of the empty cells from Datagrid for (int j=i-1;j>0;j–) { e.Item.Cells.RemoveAt(j); } } } }

Why do I get the ‘Unable to find script library ‘WebUIValidation.js” error ?

When you install the .Net framework on your web server, it installs some script files (including the above) under the root folder (usually ‘C:\inetpub\wwwroot’ if you do a default installation) . You can then find the above file at ‘C:\Inetpub\wwwroot\aspnet_client\system_web\1_1_4322’, for example. The above problem could happen if you reconfigured your web root directory to be a different one after you installed ASP.Net in your web server. If that is the case, then run ’aspnet_regiis -c’ (utility is under %windir%\Microsoft.NET\Framework\v1.1.4322, for example) or copy over manually the above script files into a similar sub-directory below your current web root directory. Also, if you look at the error message in detail, you will notice where the file is supposed to be.

How can I resize the window?

You can resize a window with JavaScript using ‘window.resizeTo(valueX,valueY)’. <script> function ResizeWindow() { window.resizeTo(800,800); } </script> Note also that the parameters of resizeTo() have different meaning in different browsers. In Internet Explorer the parameters specify the outer size of the window, while in Netscape Navigator they refer to the inner size (which does not include the window borders, toolbar, status bar, title bar, and the address line). The ‘window.resizeBy()’ method is slightly different than it’s ‘resizeTo()’ which changes the windows dimensions by number of pixels from it’s current size.