Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 27th, 2007, 05:01 PM
Authorized User
Join Date: Feb 2007
Location: , , USA.
Posts: 37
Thanks: 1
Thanked 0 Times in 0 Posts
Default Adding JSCalendar in Gridview Template Column ???

              I want to display calendar when user clik on textbox inside gridview(which is TemplateField).I want to use pretty nice calendar control "JSCalendar" for that and not deafult provided by visual studio or AJAX CalendarExtendar pop up. I tired to use <input> field but it did not diplay properly and unable to bind it with DB field so i have to use <asp:textbox> templatefield for that. does any one have idea to embeded "jsCalendar" control inside GridView.

Thanks in advance.

Reply With Quote
  #2 (permalink)  
Old August 28th, 2007, 10:21 AM
Authorized User
Join Date: Feb 2007
Location: , , USA.
Posts: 37
Thanks: 1
Thanked 0 Times in 0 Posts

I solved it by injecting some inline code.Here posting block of code responsible to display pretty nice "JsCalendar" and also bind it with database field.

<asp:TemplateField HeaderText="Expiration Date">
    <!-- <asp:TextBox id="txtExpDate" Text = '<%# Eval
        ("expiration_date") %>' runat="server" Width="100px"
            Height="13px"></asp:TextBox> -->

  <input type="text" id='<%# GetExpirationFieldID() %>'
    name="txtExpDate" value= "<%# Eval("expiration_date") %>" readonly="readonly">

 <script type="text/javascript">
       inputField : '<%# GetExpirationFieldID() %>',// id
                                                of the input field
       ifFormat : "%B %d %Y",
       //daFormat : "%Y/%m/%d"
       showsTime : false,// will display a time selector
       button : '<%# GetExpirationFieldID() %>', //
                          trigger for the calendar (button ID)
       singleClick : false,// double-click mode
       step : 1 // show all years in drop-down
                          boxes (instead of every other year as

  <!-- <cc1:CalendarExtender ID="CalendarExtender1" runat="server"
             Format="MMMM d, yyyy" >
     </cc1:CalendarExtender> -->
Besides above code we need to add reference for scripts and css related to jscalender.

<link rel="stylesheet" href="../Common/scripts/css/jscalendar/calendar-blue.css" type="text/css" />
    <script type="text/javascript" src="../Common/scripts/js/jscalendar/calendar_stripped.js"></script>
    <script type="text/javascript" src="../Common/scripts/js/jscalendar/lang/calendar-en.js"></script>
    <script type="text/javascript" src="../Common/scripts/js/jscalendar/calendar-setup_stripped.js"></script>

GetExpirationFieldID() is c# method which simply returns diffrent id for Expiration field. i.e we are associating jscalendar with each gridview row by uniqe id.

// in Code behind file.incrementing counter
   in "GridView_RowDataBound" event.

  public string GetExpirationFieldID()
        return "txtExpDate" + counter;


Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Databinding DropDownList in gridview template hughworm BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 0 October 15th, 2008 11:16 AM
Generating Textboxes with the GridView Template yes_no ASP.NET 2.0 Professional 3 September 13th, 2008 07:48 AM
Get GridView Cell Value Based on GridView Column stublair C# 2008 aka C# 3.0 0 September 4th, 2008 08:30 AM
Need to get value of gridview template columns for kmh030 ASP.NET 2.0 Professional 1 January 6th, 2007 11:10 PM
template column and bound column hidayah ASP.NET 1.x and 2.0 Application Design 1 April 9th, 2005 03:50 PM

All times are GMT -4. The time now is 10:46 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.