title: Boundfield JS Broken on PartialPostback using LoadControl
body: <p>I am building a dashboard in it we have 6 update panels which users can select above each of them from a ddl what is displayed in the updatePanel.  When the user changes the index of the ddl above the updatePanel the server side functions are called to load the appropriate user control.  Everything works great on the initial page load; however once a partial post back occurs i am having difficult finding the right html elements using my function below.  I have scoured the internet for about 10 hours today looking for the answer and I cannot seem to find the right solution.</p>
  
  <p>All the user controls use the same "ActivateGridViewRow" js function.  I have tried both UniqueID and ClientID to link to the appropriate HTML items on the HTML document but nothing works well.  Note, there is a master page and I cannot use "this" instead of e.Row.ClientID/UniqueID as a js argument because it is not always the GridView "Row" that is the item being "Activated."</p>
  
  <p>This is code from within one of the user controls "GridView_RowDataBound" function...  </p>
  
  <pre><code>[Control].Attributes.Add("onclick", "ActivateGridViewRow('" + 
      e.Row.DataItemIndex % gv_Trends.PageSize + "', '" + e.Row.UniqueID + "', '" + 
      e.Row.CssClass + "', '" + e.Row.FindControl("img_ActivateRow").ClientID + "', '" + 
      e.Row.FindControl("tr_ChildRow").UniqueID + "', 'false')");
  </code></pre>
  
  <p>Sample "ActivateGridViewRow" js function...</p>
  
  <pre><code>function ActivateGridViewRow(RowIndex, RowId, RowCssClass, RowImgId, ChildRowId, DoCallBack) {
      if (ChildRowId != "") {
          //var Row = $get(RowId);
          var Row = $get(RowId);
          if (Row == null) Row = $get("ctl00_MainContent_ctl02_" + RowId);
          var ChildRow = $get(ChildRowId);
          if (ChildRow == null) ChildRow = $get("ctl00_MainContent_ctl02_" + ChildRowId);
          var RowImg = $get(RowImgId);
          if (RowImg == null) RowImg = $get("ctl00_MainContent_ctl02_" + RowImgId);
  
          if (ChildRow.style.display == '') {
              ChildRow.style.display = 'none';
              Row.Class = RowCssClass;
              Row.style.backgroundColor = "";
              if (RowImg != null) RowImg.src = "http://localhost/resources/images/expand_blue.jpg";
              return false;
          }
          else {
              ChildRow.style.display = '';
              ChildRow.style.backgroundColor = "#F5F5F5";
              Row.Class = "";
              Row.style.backgroundColor = "#F5F5F5";
              if (RowImg != null) RowImg.src = "http://localhost/resources/images/collapse_blue.jpg";
              if (DoCallBack == "true") CallServer(RowIndex, "");
              return true;
          }
      }
  }
  </code></pre>
  
  <p><em>*</em> Note - after a partial postback the UniqueID returned does not contain the prefixed parent controls (ie, contentplaceholder id etc)...therefore it is not unique if controls are reused etc...</p>