ASP .NET DetailsView Control ObjectDataSource Parameterized Select Issue

I'm using a GridView and Details View and my datasource is a custom ObjectDataSource that returns a dataset.

This isn't a SQL server, I'm using an LDAP query to get users from Active Directory.

I have two custom datasources in the ASPX page with one bound to the GridView and one to the DetailsView. They both have SelectMethods and Parameters that work.

The GridView works perfectly. When I run the query against the Active Directory, I get my list of people in the GridView with an autogenerated select link. I can click on this link and it passes whichever value I want via the DataKeyNames to the SelectedIndexChanged event.

What I'm doing in this event is setting the parameter for the ObjectDataSource for the DetailsView control. It does call into the custom class and return back a DataSet that contains ONE USER.

What's interesting here is that when I setup this ObjectDataSource in the ASPX page, I give it a Default parameter value. When the page loads, the DetailsView control shows up with the values returned via the default parameter.

So...I know this works to some degree.

However, when I set the parameter in the SelectedIndexChanged event for the GridView, the select method in the custom class runs and returns the proper DataSet, but the DetailsView control is not updated with the new information.

Here's the ASPX code for ObjectDataSource for the DetailsView:

<asp:ObjectDataSource ID="_prvODSDetailsView" 
                  SelectMethod="_pubGetSingleUserDataSetByKerberosID"
                  TypeName="NotImportant"
                  runat="server">
   <SelectParameters>
  <asp:Parameter Direction="Input" Name="param_KerberosID" Type="String" DefaultValue="somedefaultvalue" />
   </SelectParameters>
</asp:ObjectDataSource>  

Here's my DetailsView code:

     <asp:DetailsView ID="_prvDetailsViewShown" 
              CssClass="detailgrid"
              GridLines="None"
              DefaultMode="Edit"
              EmptyDataText="<No Details Available>"
              AutoGenerateRows="true"
              DataKeyNames="KerberosID"
              DataSourceID="_prvODSDetailsView"
              Width="100%"
              runat="server">

Just to reiterate. This works on the first page load using the default value from the parameter.

        void _prvGridView_SelectedIndexChanged( object sender, EventArgs e )
    {
        DataKey k = _prvGridView.SelectedDataKey;
        string kerberosID = k.Value.ToString();
        Parameter parameter = new Parameter( "param_KerberosID", TypeCode.String, kerberosID );
        _prvODSDetailsView.SelectParameters[ 0 ] = parameter;
    }

What I'm expecting to happen is the binding occurs and the control gets automatically updated. In fact, I'm pretty sure the DetailsView binding does occur, but the control never gets updated.

What am I missing?

Thanks!

Answers


Well, I found the answer. My GridView is in an UpdatePanel (ASP .NET AJAX) and the DetailsView as not. Apparently, you can't have that.

When removed all of the AJAX components, it worked.

When I put the DetailsView in the SAME UpdatePanel as the GridView, it also worked.


Need Your Help

automator enable/disable/delete action in run applescript

applescript automator

I have an automator workflow with a Run Applescript action. Is it possible to enable/disable/delete another automator action in my Run Applescript? See my previous question for more details.

How do you disable click events from the contextmenu event when using Ctrl+Click in Safari for Mac?

javascript jquery osx dom safari

When using ctrl+ click to fire a contextmenu event (Context.JS) in Safari on Mac OS 10.9, the mousedown/up/click events also fire. This causes the menu to be closed. The events seem to occur

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.