Select from the sqldatasource and convert the output to a dataview, then place the same filter you are using, and get the count. Remember to place this code in the databound event. protected void gvCurLookup_DataBound(Object sender, System.EventArgs e) { System.Data.DataView dv = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty); dv.RowFilter = SqlDataSource1.FilterExpression; int RowCount = dv.Count; if (dv.Count > 0) { this.lblMsg.Text = dv.Count + " Books..."; } } ref http://www.c-sharpcorner.com/UploadFile/scottlysle/using-filter-expressions-with-an-sql-data-source-in-Asp-Net-C-Sharp/
So similar to other issues in the forums with other incompatible network adaptors the version of VMWare I had on my pc would not work with the version of VirtualBox 5.x well. I would get BDOS on waking up after Sleep, or sometimes after restarting or sometimes in the middle of working. My VMWare install was on a drive that died so the uninstall would not work through my Windows 7 machine. I had to go in and do a manual uninstall basically for the VMWare. I did not do a complete uninstall by messing with the registry, but I did stop the related Vmware services and uninstall the network drivers. After I did that no more blue screens of death . Edit: After a day or two. I started getting other errors. Darn. I have spent too much time on this, I think I am going to try and go back to VMWare.
It is not often when I have to go and create a DataGridView in Winforms so here are some notes. Sadly we are stuck in .net 2.0. I find it easier to add the columns manually through the designer that the datagridview will hold. Ids, text fields, buttons, etc. I have a custom CalendarColumn as well. The main fields of the columns in the dgv that are used are the HeaderText, Visible, DefaultCellStyle->Format, DataPropertyName, Name, AutoSizeMode, and Width. In case of Button UseColumnTextForButtonValue (remember to have the FlatStyle = Standard). When accessing data, the values could be nothing or DBNull.value, depending if it is a new row or not. So will need a lot of testing for DBNull or Nothing. Adding data to dgv could be done inside the dgv, but having fields outside to add to the grid is feasible as well. Modifing inside or outside grid can work. Deleting seems to work well inside. Rebinding works well after a changing...
Comments
Post a Comment