- Home
- Forum
- ASP.NET MVC
- List view How to use href action link with id
List view How to use href action link with id
Hi Vivek,
Thanks for Contacting Syncfusion Support,
We have analyzed your query and we can load another page using our existing “FieldSettings” property, then map the NavigateUrl based on the model field’s name. Please refer the following code example:
|
[cshtml] @Html.EJ().ListView("listview").ShowHeader(true).FieldSettings(f=> f.Text("texts").PrimaryKey("PrimaryKeys").NavigateUrl("rel='nofollow' href")).DataSource(Model) |
And in another way, we can achieve your requirement using existing clientSideEvent “mouseUp” in ListView component. Then can navigate another page by clicking the ListView items. Please refer the following code example:
|
[cshtml] @Html.EJ().ListView("listview").ShowHeader(true).FieldSettings(f => f.Text("texts").PrimaryKey("PrimaryKeys")).ClientSideEvents(s=>s.MouseUp("action")).DataSource(Model) |
|
[script] function action(args) { location.rel='nofollow' href = '@Url.Action("About","Home")'; } |
We have prepared the sample based on this. Please get the sample from the following location:
http://www.syncfusion.com/downloads/support/forum/123763/ze/splitterMVC_(2)1900200127
To know about the list of properties, methods, and events available in ejListView component please refer the following link:
http://help.syncfusion.com/js/api/ejlistview
Regards,
Selvamani S
Hi,
I dont understand your sample how do you achieve below, in your first sample, NavigateUrl does what? where are the parameters? 2nd example doesnt have PK paramenter. how do we use it?
below
<ul data-role="listview" data-filter="true" data-input="#myFilter" data-autodividers="true" data-inset="true">
@foreach (var item in Model)
{
<li>
@Html.ActionLink(Item .name, "Details", new { id = item.id })
</li>
}
</ul>
- NavigateUrl field – We can give the direct URL using NavigateUrl and can pass the parameters. Refer to the following code example:
|
[cshtml]
@Html.EJ().ListView("listview").ShowHeader(true).FieldSettings(f => f.Text("texts").NavigateUrl("navigate")).DataSource(Model)
[cs]
public static List<ListData> setListDataSource()
{
listTempSource.Add(new ListData { texts = "Responsive Dashboard",navigate="../ListView/navigate?par=2" });
listTempSource.Add(new ListData { texts = "Excel Filter with focus and hit enter" });
return listTempSource;
}
public ActionResult navigate(string par)//get the passing parameter
{
return PartialView("navigate");
} |
- MouseUp event – We can give the URL in mouseUp client-side event. You can pass the parameter while clicking the list items to navigate another page. Refer to the following code example:
|
[cshtml]
@Html.EJ().ListView("listview1").ShowHeader(true).FieldSettings(f => f.Text("texts")).ClientSideEvents(e=>e.MouseUp("click")).DataSource(Model)
function click(args) {
var tripId = 3;
location.rel='nofollow' href = '../Home/About?tripId=' + tripId;
} |
- 3 Replies
- 3 Participants
-
VG vivek gupta
- Apr 19, 2016 07:30 AM UTC
- Nov 2, 2017 11:48 AM UTC