Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 7th, 2006, 05:18 AM
Authorized User
 
Join Date: Apr 2006
Posts: 79
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via AIM to anujrathi Send a message via MSN to anujrathi Send a message via Yahoo to anujrathi
Default Problem in accessing the UserControl properties

I hav a userControl in which i hav placed 3 DropDownListBox or (these can be listboxes), for hours(0-12), Minutes(0-60) & AM/PM. & write the properties in .ascx.cs for accessing the values in my .aspx web page.

in the page load event of the user control, i hav written

if(! IsPostBack)
{
 for(int i=0;i<=12;i++)
 {
  if(i<=9)
   ddlHours.Items.Add(new ListItem("0" + i));
 else
  ddlHours.Items.Add(new ListItem(Convert.ToString(i)));
 }
}

& define the properties as follows:

public string Hours
{
get
 {
   return ddlHours.SelectedItem.ToString();
 }
}


I hav also import the UserControl's namespace, in the aspx page.

But when i m trying to access the value of the ddlHours in my page with button's click event:

DateTimePicker dtp = new DateTimePicker(); // Create object
Response.Write(dtp.Hours);

It gives an error

"Object reference not set to an instance of an object"

If u hav any solution. then pls send me.!!!!!!!
 
Old June 8th, 2006, 02:13 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

See this: http://p2p.wrox.com/topic.asp?TOPIC_ID=45357

By the way, it's recommended not to cross-post. The admin's don't like it.

Brian





Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing Dataset Properties kjward BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 November 16th, 2006 01:18 PM
Problem in accessing the usercontol properties anujrathi ASP.NET 1.0 and 1.1 Basics 1 June 8th, 2006 02:09 PM
Accessing Properties in User Controls andyj00 Classic ASP Professional 1 May 21st, 2005 02:52 PM
Usercontrol properties. chakravarthy_vb General .NET 1 March 31st, 2005 02:39 AM
Usercontrol Properties anothervbaddict Pro VB 6 3 July 18th, 2003 10:27 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.