Wednesday, March 3, 2010

Javascript errors in dynamic tags

function LoadValidationErrorPanel(errMessage, type)
    {
      
        var myMain =  document.getElementById("MainErrorTag");
        if (myMain== null)
        {
            myMain=document.createElement("div");
          
        }
        if (myMain.firstChild != null)
        {
            myMain.removeChild(myMain.firstChild);
        }      
        var myDiv = document.createElement("div");
        var myUL = document.createElement("ul");
        var myPara =  document.createElement("p");
        var myImg = document.createElement("img");
        var myDesc = document.createElement("strong");
      
        myDiv.className = "rounded";
      

        if(type=="error")
            myImg.setAttribute ("src","../Images/Cross.JPG");      
        else if(type=="success")
            myImg.setAttribute ("src","../Images/tick.png");      
          
        myDesc.innerText ="  "+errMessage;
      
        myPara.appendChild(myImg);
      
        myPara.appendChild(myDesc);
        myDiv.appendChild(myPara);
        myMain.appendChild(myDiv);
    }

Tuesday, March 2, 2010

Change master page meta tag in C# and ASP.Net

1.Add ID attribute in master page meta tag
2.Add the following code in Page_Load()


Header.FindControl("meta_tag_ID").Dispose();
HtmlMeta hm = new HtmlMeta();
hm.ID = "meta_new_ID";
hm.Attributes.Add("name", "viewport");
hm.Attributes.Add("content", "width = device-width,initial-scale = 1.0,maximum-scale = 2.8, user-scalable = no");
Header.Controls.Add(hm);