views:

375

answers:

0

I have been trying out the MS Ajax Toolkit Preview 6 I am trying to hook up a html table to a ... ms toolkit dataview control ... and the the dataview control get its data from an asp.net mvc controller methoid that rets Json.

But I am having an issue with send params to the asp.net mvc end point with the fetchData.

It all goes something like this ...

// this creates an object used on the aspx page, 
// the "Tex/IndexJson" is used to get the data for the html table ie contoller/method
var texIndex = texIndex({ TexListEndPoint: "Tex/IndexJson" });



// ...

//************************************
// a method of texIndex js object that sets up ms dataview to html table #tableTexList
my.LoadTexListDataViewControl = function(parm) {
    _tableTexListControl = tableTexListControl = Sys.create.dataView(
        "#tableTexList",
        {
            dataProvider: texIndex.TexListEndPoint(),
            autoFetch: true,
            rendered: my.RenderTableHeader
        }
    );
};

This all seems to work except ..

I have hooked a jquery click event ont the UI to call a method that refreshes the dataview, something like this ...

    $('#refresh-data').bind("click", function(e) {

        var fetchParm = { UserID: "johnsmith", FilterStartDt: "20091223", FilterStartDt: "20091223" };
        _tableTexListControl.set_fetchParameters(fetchParm);

        _tableTexListControl.fetchData();
        _tableTexListControl.refresh();

    });

The asp.net mvc controller method looks like this ...

public JsonResult IndexJson( string UserID )
{

    //
    var texBc = new TexBc();

    // get list of tex in reverse order
    var texBeList = texBc.ReadAll().OrderByDescending(t => t.StartDt).ThenBy(t => t.UserID);

    //-Return
    return  this.Json(texBeList);

}
/*
string filterStartDtFrom = "" ;
string filterEndDtFrom = "" ;
try
{
    UserID = this.Request.QueryString["UserID"];
    filterStartDtFrom = this.Request.QueryString["FilterStartDt"];
    filterEndDtFrom = this.Request.QueryString["FilterEndDt"];
    UserID = this.Request.Form["UserID"];
    filterStartDtFrom = this.Request.Form["FilterStartDt"];
    filterEndDtFrom = this.Request.Form["FilterEndDt"];
}
catch(Exception ex)
{
    string exMsg = ex.Message;
}
//.............................
*/

I am trying to retrieve the values set from the _tableTexListControl.set_fetchParameters(fetchParm); _tableTexListControl.fetchData();

calls in the asp.net mvc controller method. You can see I tried the binder, query string and form, but no luck.

The doco about the dataProvidor says it must be JSON Web Service URI, an instance of a Sys.Net.WebServiceProxy object, or a class that implements Sys.Data.IDataProvider ... although the examples all relate to wcf service, presumably there is a way of making the fetctParametere work against asp.net mvc since it is a JSON end point ...

probably I should stop and enjoy my xmas eve, happy xmas everyone ...