RS
Posted
on Feb 15, 2011
(permalink)
Hello,
I'm new to telerik and using ASP.NET3.5 / C#.
I'm trying to have a TabStrip using it as a Wizard just like the Demo on the telerik site. The only difference is I want to have a Preview ascx as one of the TabStrip instead of having it displayed beside the TabStrip.
Is it possible to get/view the value of controls in different ascx?
For example, using Demo for TabStrip/Wizard, is it possible to get the value of 'First Name' which is in the 'PersonalCS.ascx from 'EducationCS.ascx.cs'?
Thank you in advance,
RS
RS
Posted
on Feb 15, 2011
(permalink)
I got it using usercontrol!
But now different question came up.
Using Demo 'TabStrip/Wizard' as a example, I could get the value of 'First Name' text box in 'PersonalCS.ascx' from 'EducationCS.ascx.cs', but how can I get it from 'DefaultCS.aspx.cs'?
If I use the same method, it gives me error saying 'Object reference not set to an instance of an object' for usercontrol.
I appreciate any help!
Thank you in advance.
RS
Answer
Shinu
MVP
Posted
on Feb 16, 2011
(permalink)
Hello,
You can access the UserControl using Page.FindControl() method. Here is a sample code for accessing the UserControl on the ButtonClick event, which is in the Default.aspx page
C#:.
Thanks,
Shinu.
RS
Posted
on Feb 16, 2011
(permalink)
Thank you Shinu!
I really appreciate your quick reply to my question.
I tried it but still gives me the same kind of error... This time the error raises at "TextBox firstName = uc.FindControl("firstNameTextBox") as TextBox;"
I set the if statement to check whether uc(UserControl) is null or not and it returned uc as null....
Any suggestion or help will be appreciated.
Thank you for your time.
RS
RS
Posted
on Feb 16, 2011
(permalink)
Yay! I got it work!
I defined usercontrol like following.
UserControl uc = (UserControl)RadMultiPageID.FindControl("ucID");
Thanks!
RS