Cannot find the id of the textbox on the user control

Discussion in 'ASP .Net' started by Samy, Sep 26, 2005.

  1. Samy

    Samy Guest

    Hi There,
    I have a user control with a textbox and a button which when clicked
    opens a calendar control(calendar.aspx page). When I select a date from
    the calendar control, the date is supposed to be populated in the
    textbox. I use the user control on a index.aspx page.
    In order to achieve this I have a selected intexchange event on the
    calendar control. I pass the textbox id using the querystring when the
    button is clicked and then retrieve that using a
    htmlhiddeniput(id:control) variable on the calendar.aspx page.

    if(this.Request["textbox"] !=null)
    control.Value = Request.QueryString["textbox"].ToString();

    _startDateCalendar_Dialog.Attributes["onclick"] = "var w =
    window.open('Calendar.aspx?textbox="+this.ID+"_argument3Value_Txt','cal','width=200,height=200,left=270,top=80');w.focus();return
    false;";

    For some reason if I say window.opener.document.forms(0)." +
    control.Value + ".value = '";
    I get a JScript error saying object null or not defined.
    Becuase .net runtime cannot see the name of the textbox on the
    usercontrol, I use the syntax...this.ID +"_argument3Value_Txt' to
    idenify the textbox on the user control,
    which I pass it to the calendar page. ID refers to the id of the user
    control.

    Can anybody get back to me please as to why I am getting this error?

    Thanks a lot.
    Samy, Sep 26, 2005
    #1
    1. Advertising

  2. Samy

    Bruce Barker Guest

    use ClientId, not Id.

    -- bruce (sqlwork.com)



    "Samy" <> wrote in message
    news:...
    > Hi There,
    > I have a user control with a textbox and a button which when clicked
    > opens a calendar control(calendar.aspx page). When I select a date from
    > the calendar control, the date is supposed to be populated in the
    > textbox. I use the user control on a index.aspx page.
    > In order to achieve this I have a selected intexchange event on the
    > calendar control. I pass the textbox id using the querystring when the
    > button is clicked and then retrieve that using a
    > htmlhiddeniput(id:control) variable on the calendar.aspx page.
    >
    > if(this.Request["textbox"] !=null)
    > control.Value = Request.QueryString["textbox"].ToString();
    >
    > _startDateCalendar_Dialog.Attributes["onclick"] = "var w =
    > window.open('Calendar.aspx?textbox="+this.ID+"_argument3Value_Txt','cal','width=200,height=200,left=270,top=80');w.focus();return
    > false;";
    >
    > For some reason if I say window.opener.document.forms(0)." +
    > control.Value + ".value = '";
    > I get a JScript error saying object null or not defined.
    > Becuase .net runtime cannot see the name of the textbox on the
    > usercontrol, I use the syntax...this.ID +"_argument3Value_Txt' to
    > idenify the textbox on the user control,
    > which I pass it to the calendar page. ID refers to the id of the user
    > control.
    >
    > Can anybody get back to me please as to why I am getting this error?
    >
    > Thanks a lot.
    >
    Bruce Barker, Sep 26, 2005
    #2
    1. Advertising

  3. Samy

    Samy Guest

    Bruce,
    It gives the same result and I get the same error. Can you please
    suggest anything other than that?

    Thanks.
    Samy, Sep 26, 2005
    #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. S. Justin Gengo
    Replies:
    0
    Views:
    493
    S. Justin Gengo
    Jul 16, 2003
  2. Jacob Avlund

    Cannot find type of user control?

    Jacob Avlund, Sep 23, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    528
    Jacob Avlund
    Sep 23, 2004
  3. Samy
    Replies:
    4
    Views:
    566
  4. Replies:
    2
    Views:
    406
  5. Davids

    cannot find the user control with it's ID

    Davids, Dec 26, 2004, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    146
    Ben Strackany
    Dec 27, 2004
Loading...

Share This Page