Posts

Asp.net Charts - Url on Series Data Points

 So if you have an Asp.net chart and need to have some kind of Url over the data point areas (esp the individual bars on a bar chart, or the slices of a pie chart , etc) on the chart itself you can access the individual Points on each of your Series and set the Url property.  Another option is to set a PostBackValue which can be accessed in a click event of the chart.  This actually ended up being scrapped because I found that if you resize the image then the click areas do not match up with the image anymore.  With our responsive setup have the images be responsive was a necessity as well.  Normally the asp.net chart images have a fixed width and height...well now I know why.    DataTable dt= GetSource();         if (dt.Count != 0)         {                       ...

Fun With Automate 9 Errors

Encountered several issues yesterday within Automate 9. One problem was that the server was somehow not letting go of some files on one of the tasks resulting in the error "FTP Failed (Error: Access denied, file is locked in another upload session or by another application (550)).  The solution to that was to restart the server since I could not see what was holding on to it.  There might be other programs I could have gotten to help me identify what was holding it, but I was kind of under pressure. Another FTP task was giving some obscure Winsock Error (?)  in response to attempting to encrypt and move a file.  The error wa s "Cryptography failed (Error : File system operation failed with error (error code is 103429))". This seemed to be resolved by running the task as Administrator, or it was resolved by the rebooting of the server. On some other FTP tasks I was getting "Could not determine current location error".  This was happening when trying to...

String format for Money With No Cents.

Change the display format from {C} to {C0} which means money format but no cents.  Simple but easy to forget...

Common Table Expressions CTE in SQL SERVER - Get Top Value of a Group

So I had a problem where one of the companies we work with wanted data for a column, however they wanted a single example.  However in our system we can have multiple entries for that column. I needed to get a single example other wise when joining would show other many more rows than necessary for what they wanted.  SO I turned to Common Table Expressions (CTE)s. Although turned out that because I was excluding data one of my bosses said just not to send that field, because it would be similar to misinformation. Hah. ;With PBs(accountID,PBName,rn) AS ( select ACV.accountID, B.lastName + ', ' + B.firstName + ' ' + B.middleInit, ROW_NUMBER() OVER (PARTITION BY acv.accountID ORDER BY acv.accountID DESC) as rn FROM  ACV --- etc joins where --conditions group by ACV.accountID, B.lastName + ', ' + B.firstName + ' ' + B.middleInit ) SELECT --other fields PB.PBName FROM  ACV ---joins LEFT OUTER JOIN PBs...

CSS Child vs Descendant Selectors

Needed to style the paging elements "Next, First" etc, on a gridview pager.  I was having some trouble selecting the right elements.  No wonder becuase when you view where the actual Next element is in the html below you really have to go out of your way to get to the a element.  The descendant operator "s1 s2 {styles}" works, although I am not sure about its speed. .alphaLink td a {     padding:5px; } < tr   class =" alphaLink " >   < td   colspan =" 7 " >     < table >       < tbody >         < tr >             < td >              < a   href =" javascript:__doPostBack('dnn$ctr842$CSearch$gvCSearch','Page$Next') " > Next </ a > .... ref http://bytes.com/topic/asp-net/insights/94...

Microsoft Chart Will Not Resize with Bootstrap

I was having trouble resizing the Microsoft chart that comes with asp.net.  I am using Bootstrap but oddly enough it will only resize the width of the chart image not the height.  When you look at the page source the image is rendering with inline style width and height.  To have the bootstrap img-responsive class work properly, the width and height of the image should not be set according to the posts I was reading.  Not setting the height and width of the image did not work, it would default to 300x300, so I resorted to a Jquery solution which removes the styles from the element when the page is ready. Note: I was able to have the chart in a Bootstrap grid without the img-responsive and it would auto resize the image once the inline styles on it were removed.  Neat. <script>  $(function () {         $("#<%= Chart1.ClientID %>").attr('style', '');     }); </script>  .... ...

Get Row Count from SqlDataSource after Filtering

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/