Sunday 4 November 2012

How to find Empty Data in DataList Control




01<asp:DataList ID="dlContacts" runat="server">
02<ItemTemplate>
03
04<!-- Add your Item Template Here -->
05
06</ItemTemplate>
07<FooterTemplate>
08<asp:Label ID="lblEmpty" Text="no result" runat="server"
09     Visible='<%#bool.Parse((dlContacts.Items.Count==0).ToString())%>'>
10</asp:Label>
11</FooterTemplate>
12</asp:DataList>

Monday 29 October 2012

GridviewRowDatabound


 

 if (e.Row.RowType == DataControlRowType.DataRow)
            {
                Label newlabel= e.Row.FindControl("label1") as Label;

                String mydata = newlabel.Text;
              
                if(mydata.Equals("sometext")
                {
                    Label newlabel2= e.Row.FindControl("label1") as Label;
                    newlabel2.ForeColor = System.Drawing.Color.Green;
                }
                else
                {
                    Label newlabel2= e.Row.FindControl("label1") as Label;
                    newlabel2.ForeColor = System.Drawing.Color.Red;
                }
            }

Disable browser back button functionality using JavaScript in asp.net




<script type="text/javascript" language="javascript">
function DisableBackButton() {
window.history.forward()
}
DisableBackButton();
window.onload = DisableBackButton;
window.onpageshow = function(evt) { if (evt.persisted) DisableBackButton() }
window.onunload = function() { void (0) }
</script>

Tuesday 18 September 2012

Could not load file or assembly ‘AjaxControlToolkit’ or one of its dependencies. Access is denied.




I have solved my problem deleting my temporary files in both .net frameworks folders
C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
For 64bit systems, also check the same under the Framework*64* folders i.e.
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files

Friday 7 September 2012

Delete Multiple Cookies in Sign out button click


            HttpCookie aCookie;
            string cookieName;
            int limit = Request.Cookies.Count;
            for (int i = 0; i < limit; i++)
            {
                cookieName = Request.Cookies[i].Name;
                aCookie = new HttpCookie(cookieName);
                aCookie.Expires = DateTime.Now.AddDays(-1);
                Response.Cookies.Add(aCookie);
            }

       
            Response.Redirect("/myhomepage.aspx");


Find Mastepage Control in webpage:


Page.Master.FindControl("idname").Visible = false;

Convert SVG to PNG using svg.dll

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