Friday, 5 July 2013

Gridview row hover alert rowindex

on hover Gridview row, show row index as alert message

write onmouseover on rowdatabound

protected void mygridview_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowIndex != -1)
{
e.Row.Attributes["onmouseover"] = "showContents('" + (e.Row.RowIndex + 1) + "')";
}

}

 <script type="text/javascript">
        function showContents(rowIndex) {

            var gv = <%= mygridview.ClientID %>;
            var rowElement = gv.rows[rowIndex];
            var title = rowElement.cells[0].innerHTML;
            alert(rowIndex + ',' + title);

}

Wednesday, 26 June 2013

select from table distinct column

SELECT * FROM TABLE WITH DISTINCT COLUMN
---------------------------------------------------------------

SELECT * FROM [TABLE NAME]
WHERE [ID] IN (
  SELECT MIN([ID]) FROM [TABLE NAME] GROUP BY [DISTINCT COLUMN NAME])

Example:

       SELECT FROM [SKILLS] WHERE [ID] IN
       (
      SELECT MIN([ID]) FROM [SKILLS] GROUP BY [SKILL NAME]
       )

Friday, 21 June 2013

string split using jquery / java script

var a = "one,two,three".split(",") // Delimiter is a string
for (var i = 0; i < a.length; i++)
{
alert(a[i])
}

var b = "1+2=3".split(/[+=]/) // Delimiter is a regular expression
for (var i = 0; i < b.length; i++)
{
alert(b[i])
}

Friday, 14 June 2013

500 Internal Server Error” when adding HttpModule in my Web.config

use the following new module syntax made for IIS7 (godaddy is using IIS7 for windows hosting)
<configuration>
   <system.webServer>
      <modules>
         <add name="Header" type="Contoso.ShoppingCart.Header"/>
      </modules>
   </system.webServer>
</configuration>
here details about module tag  

Tuesday, 12 March 2013

Login failed for user 'IIS APPPOOL\ASP.NET v4.0'

Set Identity : LocalSystem
enter image description here

You can change the ApplicationPoolIdentity from IIS7 -> Application Pools -> Advanced Settings.

AdvancedSettings

Friday, 15 February 2013

How to Draw Text on an Image c#


Bitmap myBitmap = new Bitmap("C:\\myImage.jpg");
Graphics g = Graphics.FromImage(myBitmap);
StringFormat strFormat = new StringFormat();
strFormat.Alignment = StringAlignment.Center;
strFormat.LineAlignment = StringAlignment.Center;
g.DrawString("My\nText", new Font("Tahoma", 20), Brushes.White,
    new RectangleF(0, 0, 500, 500), strFormat);
myBitmap.Save("C:\\myImage1.jpg");


Convert SVG to PNG using svg.dll

      <div id="divsvg">        <svg width="350" height="300"><defs></defs> ............