Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Cannot find the id of the textbox on the user control

Reply
Thread Tools

Cannot find the id of the textbox on the user control

 
 
Samy
Guest
Posts: n/a
 
      09-26-2005
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+"_arg ument3Value_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.

 
Reply With Quote
 
 
 
 
Peter Rilling
Guest
Posts: n/a
 
      09-26-2005
Well, calendar.aspx will never be able to see the textbox because it is on a
different page.

I would suggest not having the pages talk to each other but rather pass
whatever information you need via the querystring or using JavaScript. If
you use something like showModalDialog, then you can even pass information
back to the page that opened the calendar.


"Samy" <> wrote in message
news: oups.com...
> 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+"_arg ument3Value_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.
>



 
Reply With Quote
 
 
 
 
Samy
Guest
Posts: n/a
 
      09-26-2005
Hi Peter,
I am sending the control id to the calendar page using the querystring
and using window.opener.document.forms(0)." ...to reference the opener.
I thought that's the way it should be implemented.The same
implementation works if I was using the textbox and the button (which
opens a calendar control)on an aspx page and it is not working only if
the textbox and the button are on the user control which I put it on
the page.
Please let me know if I am not clear.

Thanks.

 
Reply With Quote
 
Peter Rilling
Guest
Posts: n/a
 
      09-26-2005
I see, so you are doing this in JavaScript, good. Make sure that the ID you
are passing is actually the ID of the textbox. View source in your browser
and verify the ID for that textbox.

"Samy" <> wrote in message
news: oups.com...
> Hi Peter,
> I am sending the control id to the calendar page using the querystring
> and using window.opener.document.forms(0)." ...to reference the opener.
> I thought that's the way it should be implemented.The same
> implementation works if I was using the textbox and the button (which
> opens a calendar control)on an aspx page and it is not working only if
> the textbox and the button are on the user control which I put it on
> the page.
> Please let me know if I am not clear.
>
> Thanks.
>



 
Reply With Quote
 
Samy
Guest
Posts: n/a
 
      09-26-2005
Peter,
I am passing the exact id of the textbox, but no luck in fixing that
error.
Can you think of anything other than that?

Thanks.

 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
User Control to Control Other User Control Jonathan Wood ASP .Net 4 02-02-2010 03:41 PM
Need to find which textbox has focus from a user control. dougmcmurtry@gmail.com ASP .Net 2 03-28-2008 11:24 PM
persisting changes to a control outside a user control from the user control? Mad Scientist Jr ASP .Net 0 03-22-2006 08:02 AM
Cannot find the id of the textbox on the user control Samy ASP .Net 2 09-26-2005 08:10 PM
Re: VERY STRANGE BUG? Adding a textbox control causes other textbox control to fail??? S. Justin Gengo ASP .Net 0 07-16-2003 06:51 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57