Tuesday, April 9, 2013

Resizable Gridview

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head id="Head1" runat="server">
    <title></title>
    <script src="Scripts/jquery.js" type="text/javascript"></script>
<script src="Scripts/colResizable-1.3.min.js" type="text/javascript"></script>
<script src="Scripts/jquery.cookie.js" type="text/javascript"></script>
 <script type="text/javascript">
     $(document).ready(function () {
         if ($.cookie('colWidth') != null) {
             var columns = $.cookie('colWidth').split(',');
             var i = 0;
             $('.GridViewStyle th').each(function () {
                 $(this).width(columns[i++]);
             });
         }

         $(".GridViewStyle").colResizable({
             liveDrag: true,
             gripInnerHtml: "<div class='grip'></div>",
             draggingClass: "dragging",
             onResize: onSampleResized
         });

     });

     var onSampleResized = function (e) {
         var columns = $(e.currentTarget).find("th");
         var msg = "";
         columns.each(function () { msg += $(this).width() + ","; })
         $.cookie("colWidth", msg);
     };
</script>
</head>
<body>
    <form id="Form1" runat="server">
    <asp:Label ID="Label1" runat="server"></asp:Label>
    <br /> <br />
    <asp:GridView ID="GridView1" runat="server" CssClass="GridViewStyle">
    </asp:GridView>
    <br /><br />
     <asp:Button ID="Button1" runat="server" Text="Test Postback" />

     </form>
</body>
</html>

Code behind page

 protected void Page_Load(object sender, System.EventArgs e)
    {
        Dictionary<string, int> col = new Dictionary<string, int>();
        col.Add("key 1", 1);
        col.Add("key 2", 2);
        col.Add("key 3", 3);
        col.Add("key 4", 4);
        col.Add("key 5", 5);
        GridView1.DataSource = col;
        GridView1.DataBind();
    }
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        Label1.Text = string.Format("Current Time is {0}", DateTime.Now.ToString());
    }

Download the Source Code

Monday, March 11, 2013

Onsubmit,Onclick Tracking code -Google analytics

First you need to write the definition code in head section of web page :-

<html>
<head>
<script type="text/javascript">

var _gaq = _gaq || [];

_gaq.push(['_setAccount', 'UA-17410704-2']);

_gaq.push(['_setDomainName', 'Website URL']);

_gaq.push(['_setAllowLinker', true]);

_gaq.push(['_trackPageview']);


(function() {

var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;

ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';

var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);

})();

</script>


  <script type="text/javascript">
function submitThis()
{
_gaq.push(['_linkByPost', document.form1]);  


</script> 

</head>
<body>

<form id="form2" name="form1" method="post" onsubmit="return submitThis();" action=""

target="_top">

<a href="URL1" onclick="_gaq.push(['_link', 'URL1']); return false;" class="navBtn">Modify / Cancel Reservation

</a>



 </form>
</body>

</html>

Calculate percentage in c#

Here the example how to calculate percentage take datatype as double ;-

double x = 8;
 double y = 21;
 double i = x / y;
  i = i * 100;

Multiple Query in Single Query

Here we go:

select sum(isnull(rejectedcount,0)) as RejectedCount,AssignedtoCW from smotaskmaster where AssignedtoCW is not null  group by AssignedtoCW;

select count(*) as Approved, AssignedtoCW from smotaskmaster where (approvedbysmo=1 and approvedbyseo=1) and AssignedtoCW is not null group by AssignedtoCW;

select count(*) as Worked, AssignedtoCW from smotaskmaster where AssignedtoCW is not null and lengthcontentdesccw is not null group by AssignedtoCW;

select count(*) as pending, AssignedtoCW from smotaskmaster where (approvedbysmo=0 or approvedbyseo=0) and AssignedtoCW is not null group by AssignedtoCW;


I have tried so many thing but it doesn't work in the last finally it works for me :-


Select AssignedtoCW,sum(isnull(rejectedcount,0)) as RejectedCount,
Approved=(select count(*) from smotaskmaster  where (approvedbysmo=1 and approvedbyseo=1) AND SMM.AssignedtoCW =AssignedtoCW),
Worked=(select count(*) from smotaskmaster where AssignedtoCW=SMM.AssignedtoCW  and lengthcontentdesccw is not null),
Pending=(select count(*) as pending from smotaskmaster where (approvedbysmo=0 or approvedbyseo=0) AND SMM.AssignedtoCW =AssignedtoCW )
From smotaskmaster SMM  WHERE
SMM.AssignedtoCW is not null group by AssignedtoCW


above  query is given for your help you can modify your queries like this..... 



Saturday, February 2, 2013

Custom domain in blogger

Login Blogger Click Setting -->Basic --> in publishing click + Add a custom domain--> if you have already a domain then click on Switch to advanced settings under Advanced settings fill


Custom domain in blogger
To resolved this issue go to go-daddy control panel which look like this DNS amanager --> Edit Zone under the domain name

Custom domain in blogger

After this edit the www and add new recored with the second cname. then save in blogger it will work within in few hours.