Re: datalist edit mode and javascript pop up calendar

Discussion in 'ASP .Net' started by Saravana, Jul 18, 2003.

  1. Saravana

    Saravana Guest

    Check out this article, i have explained about the similar problem in
    datagrid. Problem is with the name of the control which you are passing to
    javascript function. For solution check this article.
    http://www.microsoft.com/india/msdn/articles/PopupCalendarinASP.aspx

    --
    Saravana
    Microsoft India Community Star,
    MCAD,SE,SD,DBA.


    "buran" <> wrote in message
    news:...
    > Dear ASP.NET Programmers,
    >
    > I am using a javascript to display popup calendar and return the selected
    > date to the control in the calling form. No problems here. When I use this
    > script for a control that is created in datalist edit mode, the popup
    > calendar doesn't return the date because it cannot find the control (or I
    > think so). Is there any way to work around this? I use the following code:
    >
    > <script language="Javascript">
    > function GetDate(ctrlName)
    > {
    > childWindow = window.open('popup.aspx?formName=' +
    > document.forms[0].name + '&ctrlName=' + ctrlName, "PopUpCalendar",
    > "width=350, height=230, top=200, left=200, toolbars=no, scrollbars=no,
    > status=no, resizable=no");
    > }
    >
    > function CloseWindow()
    > {
    > childWindow.close()
    > }
    > </script>
    > <script language="JavaScript">
    >
    > <A href="javascript:GetDate('txtDischargeDate')"><IMG
    > src="images/smallcalendar.gif" border="0"></A>
    >
    > Thanks in advance,
    >
    > Buran
    >
    >
     
    Saravana, Jul 18, 2003
    #1
    1. Advertising

  2. Saravana

    buran Guest

    Dear Saravana,

    The article helped me a lot, but I still cannot find the solution. I use the
    following code:

    Private Sub dliStayDetails_ItemDataBound(ByVal sender As Object, ByVal e As
    System.Web.UI.WebControls.DataListItemEventArgs) Handles
    dliStayDetails.ItemDataBound

    If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
    ListItemType.AlternatingItem Then
    Dim imgCal As New System.Web.UI.WebControls.Image()
    imgCal = CType(e.Item.FindControl("imgCal1"),
    System.Web.UI.WebControls.Image)
    imgCal.Attributes.Add("Onclick", "javascript:pickDate('" &
    e.Item.FindControl("txtAdmDate").ClientID & "')")
    End If

    End Sub

    and I get "Object reference not set to an instance of an object" for the
    line with the attribute.
    Thanks,

    Buran


    "Saravana" <> wrote in message
    news:...
    > Check out this article, i have explained about the similar problem in
    > datagrid. Problem is with the name of the control which you are passing

    to
    > javascript function. For solution check this article.
    > http://www.microsoft.com/india/msdn/articles/PopupCalendarinASP.aspx
    >
    > --
    > Saravana
    > Microsoft India Community Star,
    > MCAD,SE,SD,DBA.
    >
    >
    > "buran" <> wrote in message
    > news:...
    > > Dear ASP.NET Programmers,
    > >
    > > I am using a javascript to display popup calendar and return the

    selected
    > > date to the control in the calling form. No problems here. When I use

    this
    > > script for a control that is created in datalist edit mode, the popup
    > > calendar doesn't return the date because it cannot find the control (or

    I
    > > think so). Is there any way to work around this? I use the following

    code:
    > >
    > > <script language="Javascript">
    > > function GetDate(ctrlName)
    > > {
    > > childWindow = window.open('popup.aspx?formName=' +
    > > document.forms[0].name + '&ctrlName=' + ctrlName, "PopUpCalendar",
    > > "width=350, height=230, top=200, left=200, toolbars=no, scrollbars=no,
    > > status=no, resizable=no");
    > > }
    > >
    > > function CloseWindow()
    > > {
    > > childWindow.close()
    > > }
    > > </script>
    > > <script language="JavaScript">
    > >
    > > <A href="javascript:GetDate('txtDischargeDate')"><IMG
    > > src="images/smallcalendar.gif" border="0"></A>
    > >
    > > Thanks in advance,
    > >
    > > Buran
    > >
    > >

    >
    >
     
    buran, Jul 25, 2003
    #2
    1. Advertising

  3. Saravana

    Saravana Guest

    Can you post your aspx (datagrid)code also.

    --
    Saravana
    Microsoft India Community Star,
    MCAD,SE,SD,DBA.


    "buran" <> wrote in message
    news:OubI$...
    > Dear Saravana,
    >
    > The article helped me a lot, but I still cannot find the solution. I use

    the
    > following code:
    >
    > Private Sub dliStayDetails_ItemDataBound(ByVal sender As Object, ByVal e

    As
    > System.Web.UI.WebControls.DataListItemEventArgs) Handles
    > dliStayDetails.ItemDataBound
    >
    > If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
    > ListItemType.AlternatingItem Then
    > Dim imgCal As New System.Web.UI.WebControls.Image()
    > imgCal = CType(e.Item.FindControl("imgCal1"),
    > System.Web.UI.WebControls.Image)
    > imgCal.Attributes.Add("Onclick", "javascript:pickDate('" &
    > e.Item.FindControl("txtAdmDate").ClientID & "')")
    > End If
    >
    > End Sub
    >
    > and I get "Object reference not set to an instance of an object" for the
    > line with the attribute.
    > Thanks,
    >
    > Buran
    >
    >
    > "Saravana" <> wrote in message
    > news:...
    > > Check out this article, i have explained about the similar problem in
    > > datagrid. Problem is with the name of the control which you are passing

    > to
    > > javascript function. For solution check this article.
    > > http://www.microsoft.com/india/msdn/articles/PopupCalendarinASP.aspx
    > >
    > > --
    > > Saravana
    > > Microsoft India Community Star,
    > > MCAD,SE,SD,DBA.
    > >
    > >
    > > "buran" <> wrote in message
    > > news:...
    > > > Dear ASP.NET Programmers,
    > > >
    > > > I am using a javascript to display popup calendar and return the

    > selected
    > > > date to the control in the calling form. No problems here. When I use

    > this
    > > > script for a control that is created in datalist edit mode, the popup
    > > > calendar doesn't return the date because it cannot find the control

    (or
    > I
    > > > think so). Is there any way to work around this? I use the following

    > code:
    > > >
    > > > <script language="Javascript">
    > > > function GetDate(ctrlName)
    > > > {
    > > > childWindow = window.open('popup.aspx?formName=' +
    > > > document.forms[0].name + '&ctrlName=' + ctrlName, "PopUpCalendar",
    > > > "width=350, height=230, top=200, left=200, toolbars=no,

    scrollbars=no,
    > > > status=no, resizable=no");
    > > > }
    > > >
    > > > function CloseWindow()
    > > > {
    > > > childWindow.close()
    > > > }
    > > > </script>
    > > > <script language="JavaScript">
    > > >
    > > > <A href="javascript:GetDate('txtDischargeDate')"><IMG
    > > > src="images/smallcalendar.gif" border="0"></A>
    > > >
    > > > Thanks in advance,
    > > >
    > > > Buran
    > > >
    > > >

    > >
    > >

    >
    >
     
    Saravana, Jul 25, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ravikanth[MVP]
    Replies:
    2
    Views:
    3,049
    buran
    Jul 22, 2003
  2. John J Lee
    Replies:
    3
    Views:
    487
    bruno at modulix
    Dec 1, 2005
  3. Ravi Gudlavalleti

    pop-up windows in edit mode

    Ravi Gudlavalleti, Jun 22, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    118
    Eliyahu Goldin
    Jun 23, 2004
  4. Frank Kurka
    Replies:
    8
    Views:
    310
  5. Jaime Stuardo

    GridView control enters edit mode when I click Edit link twice

    Jaime Stuardo, Apr 7, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    398
    Jaime Stuardo
    Apr 7, 2006
Loading...

Share This Page