About the author

Vijay Kodali
E-mail me Send mail

Recent comments

Authors

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2024

onblur bug with RequiredFieldValidator and Google chrome browser

I came across a bug with Google chrome ver 1.0.154.43 while answering a problem in asp.net forums.

Problem:

Chrome browser ignores "onblur" event function for input box while it has Required field validator attached to it . Check this code..

  <input id="txt1" runat="server" type="text" maxlength="16" style="width: 127px" onblur= "formatSSN();"/>
  <asp:RequiredFieldValidator ID="Rfssn" runat="server" ControlToValidate="txt1" Display="None" ErrorMessage="SSN" 
     SetFocusOnError="True" EnableViewState="False">
  </asp:RequiredFieldValidator>
  <script language="javascript" type="text/javascript">
   function formatSSN() 
  {
    var ssn = document.getElementById("txt1").value;
    if(ssn.length == 9) 
        {
            document.getElementById("txt1").value= ssn.substring(0, 3) +"-" + ssn.substring(3, 5) + "-" + ssn.substring(5, 9); 
            return false;
        }
  }
  </script> 

The code works fine in IE6/7 & FireFox3, but not in Google chrome .

Solution:

I think the problem is with required field validator's SetFocusOnError property. Setting SetFocusOnError="false" for Rfv will fix it in chrome.


Posted by vijay on Saturday, January 24, 2009 8:15 PM
Permalink | Comments (5) | Post RSSRSS comment feed

TabContainer cannot have children of type error with Ajax tab control

Error:

 

You will get following error, if you try to add a sever control to AjaxTollkit’s tab panel.

 

TabContainer cannot have children of type 'System.Web.UI.WebControls.DataList'.

 

 

That’s because tab panel must be a server control, it should have an ID and runat =”server” attribute.

 

Solution:

 

Add an ID and runat =”server” attribute to that TabPanel, like this..

 

    <cc1:TabContainer ID="TabContainer1" runat="server">

        <cc1:TabPanel ID="TabPanel1" runat="server">

            <ContentTemplate>

                <asp:DataList ID="DataList1" runat="server">

                </asp:DataList>

                <asp:Label ID="Label1" runat="server" Text="Label">

                </asp:Label>

            </ContentTemplate>

        </cc1:TabPanel>

    </cc1:TabContainer>

 


Categories: AJAX | ASP.Net 3.5
Posted by Vijay on Wednesday, January 14, 2009 1:00 PM
Permalink | Comments (1) | Post RSSRSS comment feed

Dynamic Accordion control same ID _header error

Multiple controls with the same ID '_header' were found. FindControl requires that controls have unique IDs.

 I got this error, when I tried adding multiple accordion panes to the accordion control in code behind. The problem is with duplicate ID for the panes. Setting unique ID's to dynamic panes will fix the problem.

<cc1:accordion id="Accordion1" runat="Server" selectedindex="0" 
  headercssclass="accordionHeader" contentcssclass="accordionContent" 
  autosize="None" fadetransitions="true" transitionduration="250"
  framespersecond="40" requireopenedpane="false" suppressheaderpostbacks="true">
</cc1:accordion>

In Code behind:

for (int i = 0; i < 3; i++)
{
    AccordionPane pane1 = new AccordionPane();
    //Here i used Guid for uniqueness
    pane1.ID = "AccordionPane" + Guid.NewGuid().ToString();
    Label lbl = new Label();
    lbl.Text = "New pane";
    pane1.Controls.Add(lbl);
    Accordion1.Panes.Add(pane1);
}


Categories: AJAX | Web Development
Posted by vijay on Monday, January 12, 2009 12:39 PM
Permalink | Comments (0) | Post RSSRSS comment feed