Click here to Skip to main content
15,897,273 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a text box and a ajax calender in my project as below:
XML
<asp:TextBox ID="txtDOB" runat="server"></asp:TextBox>
                <cc1:CalendarExtender ID="DOBCalendarExtender" TargetControlID="txtDOB" runat="server"
                    Format= "<%# DisplayUserDateFormat()%>" PopupButtonID="DOBImageButton" OnClientDateSelectionChanged="checkDate">
                </cc1:CalendarExtender>


and I have defined the method "DisplayUserDateFormat" in the corresponding .cs file as below:
C#
public string DisplayUserDateFormat()
    {
        String strDob = "dd-MMM-yyyy";
        return strDob ;
    }


But, when I set a breakpoint on this method, it is not getting called.
Can anyone tell me why it is happening?
Posted

Try: Format= "<%=DisplayUserDateFormat()%>"
 
Share this answer
 
Comments
bedathur_ganesh 8-Jul-10 11:45am    
No, this is not working.
Sorry, "<%=DisplayUserDateFormat()%>" only works with non-server tags.

You have to use PageMethods to do what you want.

Check this http://www.dotnetcurry.com/ShowArticle.aspx?ID=109&AspxAutoDetectCookieSupport=1[^]
 
Share this answer
 
You're using databinding syntax...are you actually calling Databind() in your page?

I usually do it on the PreRender event.
 
Share this answer
 
You can simply change the format in server side (.cs file)

DOBCalendarExtender.Format = DisplayUserDateFormat();
 
Share this answer
 
Comments
bedathur_ganesh 9-Jul-10 3:10am    
Thanks.. It is working..
Please can you try using Format= '<%# DisplayUserDateFormat()%>' instead of Format= "<%# DisplayUserDateFormat()%>"
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900