p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 2.0 Professional (http://p2p.wrox.com/forumdisplay.php?f=215)
-   -   Re-assign the Control ID after Postback / Error (http://p2p.wrox.com/showthread.php?t=44222)

AbrarNazeer June 20th, 2006 06:53 AM

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.



jbenson001 June 20th, 2006 10:18 PM

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


AbrarNazeer June 21st, 2006 01:43 AM

 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

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



jbenson001 June 21st, 2006 10:09 AM

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


AbrarNazeer June 22nd, 2006 12:51 AM


 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





roopesh July 22nd, 2006 07:53 AM

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

AbrarNazeer July 22nd, 2006 11:34 PM


 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.



All times are GMT -4. The time now is 03:54 AM.

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