Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 856445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:14:13+00:00 2026-05-15T08:14:13+00:00

I’m having masses of trouble getting an ObjectDataProvider work with method parameters. Now with

  • 0

I’m having masses of trouble getting an ObjectDataProvider work with method parameters. Now with the following code, I can view the data in the XAML visual studio designer, however once I try to refresh the ObjectDataProvider my data disappears. I’ve setup an object data provider with five parameters, although these are not passed to the dataset query, I just want to see if I can pass these parameters first. I run the filter method at the bottom to refresh the OBJDataProvider and my datagrid goes blank?

My two ObjectDataProviders

<ObjectDataProvider x:Key="LogDataProvider" ObjectType="{x:Type local:LogDataProvider}"/>

<ObjectDataProvider x:Key="siteListContains" MethodName="GetLog2" ObjectType="{x:Type local:LogDataProvider}">
   <ObjectDataProvider.MethodParameters>
      <s:String>Red</s:String>
      <s:DateTime>12:14:24</s:DateTime>
      <s:DateTime>2008-01-01</s:DateTime>
      <s:DateTime>12:12:12</s:DateTime>
      <s:DateTime>2008-01-01</s:DateTime>
   </ObjectDataProvider.MethodParameters>
</ObjectDataProvider>

The datagrid and it’s binding to the Object Data Provider

<dg:DataGrid Name="log_datagrid" Height="230" VerticalAlignment="Stretch" 
DataContext="{Binding Source={StaticResource siteListContains}}" 
ItemsSource="{Binding}" AutoGenerateColumns="True"/>

My LogDataProvider class

public class LogDataProvider
{
   private eventlogTableAdapter adapter;
   DataSet1 dataset;

   public LogDataProvider()
   {
      dataset = new DataSet1();
      adapter = new eventlogTableAdapter();
   }

   public DataView GetLog2(string sitestr, DateTime fromtimestr, DateTime fromdatestr, DateTime totimestr, DateTime todatestr)
   {
      adapter.Fill(dataset.eventlog);
      return dataset.eventlog.DefaultView;
   }
}

Here I’ve ran into problems, when I pass the sitestr to MethodParameter[0], it immediately jumps to the GetLog2 method of the LogDataProvider, without taking in the rest of the parameters… Then my datagrid goes blank 🙁

private void filter_btn_Click(object sender, RoutedEventArgs e)
{
   ObjectDataProvider sitelist_dataobj = this.FindResource("siteListContains") as ObjectDataProvider;
   sitelist_dataobj.MethodParameters[0] = sitestr.Text.ToString();
   sitelist_dataobj.MethodParameters[1] = from_timePicker.SelectedTime;
   sitelist_dataobj.MethodParameters[2] = from_datepicker.SelectedDate;
   sitelist_dataobj.MethodParameters[3] = to_timePicker.SelectedTime;
   sitelist_dataobj.MethodParameters[4] = to_datepicker.SelectedDate;

   sitelist_dataobj.Refresh();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T08:14:14+00:00Added an answer on May 15, 2026 at 8:14 am

    It should call Refresh every time you update any of the parameters. If you’re going to set more than one, you should use DeferRefresh to make it wait until you’re done:

    private void filter_btn_Click(object sender, RoutedEventArgs e)
    {
        ObjectDataProvider sitelist_dataobj = this.FindResource("siteListContains") as ObjectDataProvider;
        using (sitelist_dataobj.DeferRefresh())
        {
            sitelist_dataobj.MethodParameters[0] = sitestr.Text.ToString();
            sitelist_dataobj.MethodParameters[1] = from_timePicker.SelectedTime;
            sitelist_dataobj.MethodParameters[2] = from_datepicker.SelectedDate;
            sitelist_dataobj.MethodParameters[3] = to_timePicker.SelectedTime;
            sitelist_dataobj.MethodParameters[4] = to_datepicker.SelectedDate;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.