Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old October 12th, 2007, 10:30 AM
Authorized User
 
Join Date: Sep 2007
Location: Quito, Pichincha, Ecuador.
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default User controls

Hello everybody!!!!

I am trying to customize my own user control. The problem is that I don't know how to work with functions. When I create a function in the .ascx file I don't know how to call it from my .aspx file.

My control has 2 dropdownlists and one textbox. I want to read their values when the user enters new information. I want to do this from my .aspx file (the one that contains my user control)

Thank you in advance!!!

pd. If I want to validate my control, where is it better to do it?
Reply With Quote
  #2 (permalink)  
Old October 28th, 2007, 01:53 PM
Friend of Wrox
Points: 410, Level: 7
Points: 410, Level: 7 Points: 410, Level: 7 Points: 410, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2004
Location: New Delhi, India.
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anubhav.kumar
Default

Hi,

The functions you are creating should be either FRIEND or PUBLIC.
In the aspx file, you will have an object of the user control accessible via the ID of control on your aspx page. Using this object, u can access your functions.

As far as validation is concerned, it should be on the control itself. This is because, as you said that your control is a composite control[has many child controls], but on the aspx page all those will be treated as a single object. The individual validation for each child control in your user control can only be implemented in the user control itself. And it is the recommended way !!

Reading the control values goes the same way, instead of functions, implement the values a s properties, in ascx, then call those properties from aspx.

Anubhav Kumar
Reply With Quote
  #3 (permalink)  
Old October 28th, 2007, 08:20 PM
Authorized User
 
Join Date: Sep 2007
Location: Quito, Pichincha, Ecuador.
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks a lot for your kindness
Regards
Reply With Quote
Reply


Thread Tools
Display Modes

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
User controls' content: Chapter 2 User Controls AGS BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 10 July 26th, 2007 06:36 AM
User Controls Lofa ASP.NET 1.0 and 1.1 Basics 2 February 13th, 2006 01:04 PM
User Controls..... Help please cowboy2066 General .NET 2 July 28th, 2004 10:22 AM
User Controls Duncan Pro VB.NET 2002/2003 2 December 1st, 2003 05:41 AM
User Controls Duncan Pro VB.NET 2002/2003 1 October 27th, 2003 12:51 PM



All times are GMT -4. The time now is 12:41 PM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.