Posts

Open Modal on GridView Row Command

Notes on  How to Open Modal on GridView Row Command.  The Update Panel is important when doing it this way.  Have the grid and the entire modal within a UpdatePanel. In the Columns section   <asp:CommandField ShowSelectButton="True" SelectText="Detail" /> In the markup put function to <script type = "text/javascript">  function openModal() {         $('#detailModal').modal('show');     } </script> In the row command  protected void grdDetail_RowCommand(object sender, GridViewCommandEventArgs e)     {         if (e.CommandArgument == string.Empty)         {             return;         }         int index = Convert.ToInt32(e.CommandArgument);    ...

Vertically Align Bootstrap Modal Popup

Very nice.  I would not have been able to come up this nice of a solution.  Definitely will use. http://stackoverflow.com/questions/18053408/vertically-centering-bootstrap-modal-window " This does the job : http://jsfiddle.net/sRmLV/53/ It uses a helper-div and some custom css. No javascript or jQuery required. HTML (based on Bootstrap's demo-code ) <button class = "btn btn-primary btn-lg" data-toggle = "modal" data-target = "#myModal" > Launch demo modal </button> <!-- Modal --> <div class = "modal fade" id = "myModal" tabindex = "-1" role = "dialog" aria-labelledby = "myModalLabel" aria-hidden = "true" > <div class = "vertical-alignment-helper" > <div class = "modal-dialog vertical-align-center" > <div class = "modal-content" > <div class ...

GridView Asp.net with BoundField and Template Example

Since I sometimes forget. The boundfield should have the SortExpression in order to sort.  Using the template allows you to calls at least protected functions on the data coming from the data source.  Need to add the LinkButton in order to sort, with the CommandName and CommandArgument with "Sort" and the datafield name respectively.  <asp:GridView             ID="gvName"             runat="server"             DataSourceID="sdsSpName"             AutoGenerateColumns="False"             AllowSorting="True"             GridLines="None"             Width="100%"      ...

No One should ever import images from Access ever again

Hello, going to explain exactly what is going on with these logos, if/when this becomes an issue again.   And why from now on No One should ever import images from Access ever again . When inputting an image into the database through Access, Access formats the image into something called an OLE Image Object.   You can tell an OLE Image Object by looking at the value in the database in the table, because they start with 0x151C.   The reason why loading it through Access is such an issue is that it makes it impossible to load it normally through .Net applications, meaning you cannot view them through a desktop programor through any of our sites , you can only view them in Access and Crystal Reports.   Access adds data to the beginning and end of the image for an undetermined number of bytes which depends on a number of factors such as the file type and location you loaded it from.   The only way to display such a file is to strip the bytes from the be...

An exception of type 'System.UriFormatException' occurred in System.dll but was not handled in user code Additional information: Invalid URI: The Uri string is too long.

This happened to me when I was resizing an image, and did not put the image type when converting it to a byte array and then converting to base64. Also was previously trying all sorts of ways to display this one image from the database.  Turns out some person was directly dropping the image into the column through Access.  Weirdly enough that way works in Crystal Reports, but I cannot get it to display on a web page no matter what I tried.  Tried for something like 12 hours or so over 2-3 days, so there is something odd with that. Should look something like these. imgRepPic.ImageUrl = "data:image/jpeg;base64," & Convert.ToBase64String((DirectCast(dtPic(0)("repPic"), Byte()))) ..... Dim imgTemp As Image = ScaleImage(System.Drawing.Image.FromStream(stream), 100)   imgRepPicProportional.ImageUrl = "data:image/jpeg;base64," & Convert.ToBase64String((ImageToByteArray(imgTemp))) ....   Public Shared Function ScaleImage(curImage As System.D...

jQuery Tabs Keeping the current tab on Postback

This solution on the asp.net forum was very nice and easy to implement.  Essentially using A hidden value and control to keep track of the value, and on page load to set the active tab to the last one that was active. http://forums.asp.net/t/1964624.aspx?Maintaining+tab+position+on+post+back

DNN Powerful Skin skin.less.txt wasn't found (404) FileError

If you receive this error you are probably blocking the txt file from being accessed.  In my case that particular site was blocking all txt files on the web server in IIS.  Specifically under the HTTP Features -> Request Filtering under IIS, then find the .txt extension, right click and click "Remove".   Once that restriction was removed the sites started showing some modifications properly. Before some odd things were happening like white text on white background, and inability to change any colors via the color picker menu.