Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 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
  #1 (permalink)  
Old June 20th, 2006, 06:53 AM
Authorized User
 
Join Date: Jun 2006
Location: , , .
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re-assign the Control ID after Postback / Error


 BackGround
     I have GridView with SqlDataSource to populate it. While I have Custom Search Control on my WebPage. When ever i click the srch btn to populate the grid its OK but when i put any srch data in any ctrl (e.g City = 'KHI' in city textbox) and then click the srch btn i suffered for the following msg

ERROR Message
================================================== ==================
An error has occurred because a control with id 'grdComplaints$ctl04$ctl00' could not be located or a different control is assigned to the same ID after postback. If the ID is not assigned, explicitly set the ID property of controls that raise postback events to avoid this error.
================================================== ==================

 If any one has been faced and resolved such error then plz help me.
 Thanks for your time.


  #2 (permalink)  
Old June 20th, 2006, 10:18 PM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Can you post the code that calls your seach? Is the searc a button you click.. is it in the grid..? More info is needed.

Jim

  #3 (permalink)  
Old June 21st, 2006, 01:43 AM
Authorized User
 
Join Date: Jun 2006
Location: , , .
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default

 Search is my <asp:Button ID="btnSearch" runat="server" Text="Search" />
 it is not in the Grid.

btnSearch_Click
  does this
-------------------------------------------------------------------

             If Me.grdComplaints.Rows.Count = 0 Then
                lblErrorMsg.Text = "No Record Found."
                Me.pnlListComplaints.Visible = False
                Exit Try
             End if

-------------------------------------------------------------------


  #4 (permalink)  
Old June 21st, 2006, 10:09 AM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Is there somewhere that you are changing the ID of the grid, or other controls you create dynamically?

  #5 (permalink)  
Old June 22nd, 2006, 12:51 AM
Authorized User
 
Join Date: Jun 2006
Location: , , .
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default


 Jim thanks for ur time.......
 ur qries and their answers are here below

 Qry#1. Is there somewhere that you are changing the ID of the grid
 Ans. NO

 Qry#2. or other controls you create dynamically?
 Ans. NO




  #6 (permalink)  
Old July 22nd, 2006, 07:53 AM
Registered User
 
Join Date: Jul 2006
Location: mumbai, maharashtra, India.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

During postback your control ids might be getting changed. Check the page source to see whether the control id is as you want to be.

roopesh
  #7 (permalink)  
Old July 22nd, 2006, 11:34 PM
Authorized User
 
Join Date: Jun 2006
Location: , , .
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default


 Thanks Roopesh !
         There was a mistake by me.GridView Control's EnableViewState Property was set to 'False' when i change it to 'True' it becomes functional.
       Once again thanks for ur time.



Similar Threads
Thread Thread Starter Forum Replies Last Post
Pull data values & assign them to a text control cesemj ASP.NET 2.0 Basics 0 March 12th, 2008 06:54 AM
Calendar Control Postback x_ray ASP.NET 2.0 Basics 1 May 27th, 2007 03:56 AM
Validation control and postback Chaotix ASP.NET 1.0 and 1.1 Basics 0 July 18th, 2006 12:31 PM
catching the control that causes postback ACE2084 ASP.NET 1.0 and 1.1 Basics 1 February 22nd, 2005 04:00 PM





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