locked
Pass parameter to usercontrol RRS feed

  • Question

  • Hi friend developers... In my application, i call usercontrol that is a draggble datagrid, i want to pass one parameter to the server side of that user control when i call it from my page.xaml. What i m trying to get is having the same datagrid/usercontrol, binding difrente webservices.

    So if i push button 1 it call datagrid with webservice 1, if i push button 2 call the same datagrid usercontrol but with webservice 2

    Can i use this in my user contro?

      public partial class datagrid : UserControl

    {

    public datagrid(string option)

    {

    InitializeComponent();

    if (option ="ocorr")

    Loaded +=
    new RoutedEventHandler(Ocorrencias_Loaded);

     

    }

     

    and this calling it?

     

    private void Button_Click(object sender, RoutedEventArgs e)

    {

    Datagrid ocrr = new Datagrid(1);

     

    LayoutRoot.Children.Add(ocrr);

    }

     

    Thanks in advance

    Rui

    Wednesday, March 26, 2008 7:12 AM

Answers

  • Hello, you can create a property in your custom DataGrid to store the service URL.

    Friday, March 28, 2008 4:26 AM

All replies

  • ok.. it works.. dumb question, the problem was in my borwser. i reboot the computer and it works..

     

    but is it possible do to it in the client side, in the xaml something like this?

     <controls:datagrid x:name="grid1" paramenter="op" ></controls:datagrid

    Wednesday, March 26, 2008 8:15 AM
  • Hello, you can create a property in your custom DataGrid to store the service URL.

    Friday, March 28, 2008 4:26 AM