15,949,686 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Rob Howard (Top 1 by date)
Rob Howard
7-Nov-18 10:07am
View
Thanks for the responses!
On the vague response, sorry about that, it was late a night and I was ready to hit the hay.
I have a form view on a page that will be displaying a date as a label under the <itemtemplate> for the form view. That works great. But when I click the Edit link on the form view, I'd like to have a small calendar image that would be clicked and calendar would appear. Once the calendar appears, you would be able to select the date and that date would populate into a text box.
The calendar mark up was just a calendar that I threw in the form view. Nothing really special with the calendar as of yet. I thought I'd try to tackle the harder bit first.
Mind you, I have been able to create a date picker before outside of a form view. But it seems that once I put the same date picker code (different page) into the form view, the form view barks at me. (Object reference not set to an instance of an object).
I've made a small change (see below) to the code and added the CS side as well.
FormView
<asp:FormView ID="KeyDates_FV" runat="server" CellPadding="4" DataKeyNames="ID" DataSourceID="KeyDates_SQL" ForeColor="#333333" GridLines="Both" OnDataBound="KeyDates_FV_DataBound">
<edititemtemplate>
LAA_PlanDate:
<asp:TextBox ID="LAA_PlanDateTextBox" runat="server" Text='<%# Bind("LAA_PlanDate") %>' />
<asp:Calendar ID="LAA_PlanDate_CAL" runat="server" ForeColor="White" Visible="false">
<asp:ImageButton ID="LAA_PlanDate_IMB" runat="server" ImageAlign="Bottom" ImageUrl="~/Images/Calendar_icon.png" Width="16px" OnClick="LAA_PlanDate_IMB_Click" />
CS page
protected void LAA_PlanDate_IMB_Click(object sender, ImageClickEventArgs e)
{
Calendar LAA_PlanDate_CAL = (Calendar)FormView1.FindControl("LAA_PlanDate_CAL");
LAA_PlanDate_CAL.Visible = true;
}
Thank you again for the help in advance!