Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics 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
 
 
Thread Tools Display Modes
  #11 (permalink)  
Old March 17th, 2010, 12:11 AM
Authorized User
 
Join Date: Mar 2010
Posts: 65
Thanks: 6
Thanked 0 Times in 0 Posts
Default

I dont know where exactly should i add the 'hov' control, in a Seperate container or in the dynamically created Form control?

when i add it in the seperate Table cell, i get a error message:

Error Message:

"The TargetControlID of '' is not valid. A control with ID 'but1' could not be found. "

i changed my codings as:

TableHeaderCell commvote = new TableHeaderCell();
Button but1 = new Button();
but1.Text = "Hover button";
commvote.Controls.Add(but1);

TableCell hovbut = new TableCell();
AjaxControlToolkit.HoverMenuExtender hov = new AjaxControlToolkit.HoverMenuExtender();

Panel pan1 = new Panel();
Label lab = new Label();
lab.Text = "Empty Panel";
pan1.Controls.Add(lab);

hov.TargetControlID = "but1";
hov.PopupControlID = "pan1";

hovbut.Controls.Add(hov); //when i add the button control here, it gives me no error message and displaying the button control, but not perfoming any hover button function. but when i add the 'hov' button here, it gives me error message as Above.

comm.Cells.Add(hovbut);//comm is the name of the TableRow.


Can you give me any example?

Last edited by Gayathri79; March 17th, 2010 at 12:18 AM.
  #12 (permalink)  
Old March 17th, 2010, 01:04 AM
Registered User
 
Join Date: Mar 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default auto suggest

hallo sir i want to know how we can use auto suggest
  #13 (permalink)  
Old March 17th, 2010, 03:52 AM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,960
Thanks: 79
Thanked 1,559 Times in 1,536 Posts
Default

Hi Gayathri79,

You're not really assigning an ID to the button, Naming the variable but1 doesn't give it an ID. Try something like this:

Button but1 = new Button();
but1.ID = "Button1";
but1.Text = "Hover button";
commvote.Controls.Add(but1);

If this code runs in a loop, be sure to make the ID dynamic (e.g. something like "Button" + i.ToString() where i is your loop counter).

Once each button has a unique ID, you need to assign its client ID to the hover control:

hov.TargetControlID = but1.ClientID;

The ClientID is the ID of the button in the final, client side HTML.

You need to deploy the same trick for the panel: give it a unique ID and assign that to the hover control using ClientID.

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
Gayathri79 (March 17th, 2010)
  #14 (permalink)  
Old March 17th, 2010, 03:54 AM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,960
Thanks: 79
Thanked 1,559 Times in 1,536 Posts
Default

Hi umeshdwivedi,

Can you please start new threads for new topics? Makes it easier to follow a thread and work with its replies.

http://www.asp.net/AJAX/AjaxControlT...oComplete.aspx

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #15 (permalink)  
Old March 17th, 2010, 04:07 PM
Authorized User
 
Join Date: Mar 2010
Posts: 65
Thanks: 6
Thanked 0 Times in 0 Posts
Default

Thank you so much. i le try that.
  #16 (permalink)  
Old March 18th, 2010, 11:33 PM
Authorized User
 
Join Date: Mar 2010
Posts: 65
Thanks: 6
Thanked 0 Times in 0 Posts
Default

Hi Imar,
I tried what you told me. Button control got its uique ID. But the hover Extender control's TargetId is not finding the Button control's ClientID.

I am working with .aspx web form from Master page where i tried that, where i got a Error Message:

" The TargetControlID of '' is not valid. A control with ID 'Button0' could not be found. "

I also tried in the actual web form without using Master page. There it works. Hover control is working there.

Codings:

for (int i = 0; i <= 10; i++)// This is a sample loop. Database contains only 4 recors.
{
while (reader.Read())
{

TableRow ----
-----------
-----------

TableRow comm = new TableRow();
TableHeaderCell commvote = new TableHeaderCell();

Button but1 = new Button();
but1.ID = "Button" + i.ToString();
but1.Text = but1.ID;


Panel pan1 = new Panel();
pan1.Height = Unit.Pixel(100);
pan1.Width = Unit.Pixel(100);
pan1.BackColor = Color.Chocolate;
pan1.ID = "panel" + i.ToString();
Label lab = new Label();
lab.Text = pan1.ID;
pan1.Controls.Add(lab);


AjaxControlToolkit.HoverMenuExtender hov = new AjaxControlToolkit.HoverMenuExtender();
hov.TargetControlID = but1.ClientID;
hov.PopupControlID = pan1.ClientID;
Form.Controls.Add(hov); //If i dont use this line, i am getting only the Button, but hover is not working. otherwise i am getting the Error message. I also tried to add the 'hov' in a separate Table cell. also not working.

commvote.Controls.Add(but1);
comm.Cells.Add(commvote);

Tablevar1.Rows.Add(comm);
i++;

}

}
  #17 (permalink)  
Old March 19th, 2010, 04:38 AM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,960
Thanks: 79
Thanked 1,559 Times in 1,536 Posts
Default

Hi there,

Looks like the Master Page is changing the client ID of the button. This is by design. Not sure why the code is not taking that into account. In what event are you doing this? Try to move your code to Page_Init. Also, take a look at the final HTML and see what the actual ID of the button is.

Also, I am not sure this is a good idea:

for (int i = 0; i <= 10; i++)// This is a sample loop. Database contains only 4 recors.
{
while (reader.Read())
{
This loops 10 times and inside that loop you loop over the database records. That means all database records get the same ID of 0....

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #18 (permalink)  
Old March 21st, 2010, 04:13 PM
Authorized User
 
Join Date: Mar 2010
Posts: 65
Thanks: 6
Thanked 0 Times in 0 Posts
Default

Hi Imar,
I was working with Page_load event. I also tried in Page_Init as you said. Looks like the same Issue.
But when i disable the hover control itself and tried to display only the Button with its CLientId. IT displayed the Button Id correctly( Each record has its own Id like Button0,button1,button2...). So looks like Master page is accepting Client Id.
But when i add the hover control, there i get a Error Message asusual:

" The TargetControlID of '' is not valid. A control with ID 'Button0' could not be found. "

Looks like a problem with Hover control Extender.
I am adding this control like:

Form.Controls.Add(hov);//hov is dynamically created hovercont********************tender.

So is there any other way to add the panel control as a popup for the Button control without using hovercont********************tender?
  #19 (permalink)  
Old March 22nd, 2010, 03:55 AM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,960
Thanks: 79
Thanked 1,559 Times in 1,536 Posts
Default

Can you post a stripped version of the complete source, including the master page? Then I can try it locally here. Please try to get rid of irrelevant code such as CSS etc.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #20 (permalink)  
Old March 23rd, 2010, 03:30 AM
Authorized User
 
Join Date: Mar 2010
Posts: 65
Thanks: 6
Thanked 0 Times in 0 Posts
Default

Yes I can post it.

-Do you also want my Database file? If yes, how do you want me to post it?

-If I remove my Css file, it looks totally different with Extra large fonts. Are going to Execute the File?

-Thanks
Gayathri
 


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
Problem regarding Login controls bond007 ASP.NET 2.0 Basics 1 April 16th, 2009 02:14 AM
Problem with Try it Out List Controls phage BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 6 September 15th, 2008 03:15 PM
Problem with user controls jamara ASP.NET 2.0 Basics 7 November 17th, 2006 05:34 PM
problem in user controls nishantmp1 ASP.NET 1.0 and 1.1 Basics 1 September 27th, 2006 10:43 AM
problem in using Image controls harini19 VB How-To 1 March 5th, 2004 02:34 PM



All times are GMT -4. The time now is 08:39 AM.


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