We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Pass Parameter to do a search.

Thread ID:

Created:

Updated:

Platform:

Replies:

116083 Mar 30,2014 09:09 PM Apr 2,2014 07:56 AM ASP.NET MVC (Classic) 2
loading
Tags: Grid
Darren
Asked On March 30, 2014 09:09 PM

We have a grid, with data populating perfectly as required, Using our own objects. example. Document

public int Id{get;set}

public string DocumentName{get;set;}

public string DocumentEncryptionCode{get;set;}

public Int64 DocumentSize{get;set;}

...........


To retrieve the objects we would say:

List<DocumentObject> searchObjects = Document.SearchDocumentObjects(applicationObject.Id, "")

Returning n documents

After this loads the end user decides we need all documents with an '@' (could be any string) in the users who have downloaded the document.

This is not stored in table or displayed,

so we have a stored procedure, object retrieval doing the following:

List<DocumentObject> searchObjects = Document.SearchDocumentObjectsWithBorrowerName(applicationObject.Id, "@")

how do I call the

     [AcceptVerbs(HttpVerbs.Post)]
public ActionResult DocumentSearch(PagingParams args){ /*we want to include a parameter like string searchString*/
        ApplicationObject applicationObject = Application.GetApplicationByName("SampleDocuments");
        List<DocumentSearchObject> searchObjects = DocumentSearch.SearchDocumentObjectsWithBorrowerName(applicationObject.Id, searchString);
       return searchObjects.GridJSONActions<SearchDocumentObject>();

}

What I need to do is pass certain parameters to a Controller,

Our view has the following:

 @{ Html.Syncfusion().Grid<DocumentSearchObject>("OutputGrid")
 .Caption("Gas Victoria")
 .AutoFormat(Skins.Metro)
 .ActionMode(ActionMode.JSON)
 .EnablePaging()
 .Column(columns =>
 {
   columns.Add(p => p.DocumentRevisionId).HeaderText("Title").TemplateColumn(true).TemplateName("../Templates/PLINEThumbnail").Width(200);
   columns.Add(p => p.Desciption).HeaderText("Desciption").Width(150);
   columns.Add(p => p.Filename).HeaderText("FileName").Width(100);
   columns.Add(p => p.DateStamp).Width(55).Format("{0:dd/MM/yyyy}");})
 .Scrolling(scroll => scroll.Height(560))
.PageSettings(p =>
{p.PageCount(15);p.PageSize(24);p.AllowPaging(true);})
.Render();
}


 


Darren
Replied On March 30, 2014 10:21 PM

Ok I worked this part out, I have to call the

.QueryParam("?descriptionText=" + "&titleText=" + "&startDateTime=" + "&EndDateTime=")

but now my issue is how do I fill in the values. I have a fields that someone enters the data into: eg descriptionTextBox,

 

how do I get this out of the form and into the query string????? Ive tried everything. I cant pass the formCollection through as this only passes the DataGridValues

 


Shanmugaraja K [Syncfusion]
Replied On April 2, 2014 07:56 AM

Hi Darren,

 

Thanks for using Syncfusion products.

 

We would like to let you know that your requirement has been achieved by handling queryparam property to pass the text value to controller. Please refer the below code snippet to achieve your requirement.

 

[CSHTML]

 

@{ using (Html.BeginForm("ControlsInLayout", "Layout", FormMethod.Get))

 {

    <p>Enter duration: </p>

    @Html.TextBox("duration")

    <input type="submit" value="submit" id="sub"/>

 }}

….

 

<div class="sample-panel-margin" id="grid1" style="width: 95%;">

        @(Html.Syncfusion().Grid<qureyparam.Models.Student>("GenericListGrid")

    .ActionMode(ActionMode.JSON)

    .Caption("Student Details")

….

.QueryParam("?duration=" +ViewData["Detail"])

 

[CS]

 

public ActionResult ControlsInLayout(int? duration)

        {

            ViewData["Detail"] = duration;

            return View();

        }

      [AcceptVerbs(HttpVerbs.Post)]

      public ActionResult ControlsInLayout(PagingParams args, int? duration)

      {

          IEnumerable data;

          if (duration != null)

          {

              data = new StudentDataContext().Student.Where(s => s.Duration == duration).Take(10).ToList();

          }

          else

          {

              data = new StudentDataContext().Student.Take(100).ToList();

          }

          return data.GridJSONActions<Student>();

      }

 

Also refer the below sample for further reference


 

If we misunderstood your requirement  please get back to us with more information so that we can analyse based on your scenario and provide you a better solution.

 

Please let us know if you need further assistance.

 

Regards,

Shanmugaraja K


Attachment: qureyparam_2b765f4c.zip

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;