Click here to Skip to main content
15,949,686 members

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!