如何在Web API中创建列表视图 [英] How to create a listview in web API
问题描述
你好
我从asp.net切换到web API,我的问题是我不知道如何在web API中创建listview。我想在没有asp控件和使用jquery和ajax的情况下创建它。你可以帮帮我吗?
我想知道如何在没有asp控件的情况下编写这些代码:
Hello
I am switching from asp.net to web API, my problem is that I don't know how to create a listview in web API. I want to create it without asp controls and using jquery and ajax. can you please help me ?
I wan to know how to write these codes without asp controls:
<asp:ListView runat="server" ID="lvProducts">
<itemtemplate>
;div class="name"><a href="UProductDetail.aspx?PrID= " + Eval("PrID")">;span><%# Eval("PrName") %></span></a></div>
<div class="big-btns"> <a href="UProductDetail.aspx?PrID= " + Eval("PrID") ">More Detail;/a> <asp:Button runat="server" ID="btnAddBasket" Text="Add to Basket" OnClick="btnAddBasket_Click" CommandArgument=' Eval("PrID") '/div>
我不知道如何在jquery中使用commandArgument以及如何构建ListView并通过选择的产品ID转到产品详细信息
我尝试了什么:
我尝试过jqxWidget等jqxWidget,但是它没有帮我模拟上面的代码
I don't know how to use "commandArgument" in jquery and how to build the ListView and go to product detail by the Product ID selected
What I have tried:
I have tried jqxWidget such as jqxListBox but it didn't help me to simulate the code above
推荐答案
您无法在WebAPI中创建任何可视组件,我认为您对您的技术感到困惑。
You can't create any visual components in WebAPI, I think you're getting confused with your technologies.
WebAPI h不是视觉元素。它用于提供一个接口,公开其他应用程序与WebAPI公开的数据交互的方法。
如果你正在建立一个网站,你继续使用ASP 。净。 WebAPI是完全独立的,用于非常不同的目的。
您的ASP.NET应用程序可以使用WebAPI进行数据操作,主要使用相同的界面Windows窗体应用程序,WPF应用程序或移动应用程序用于与相同的数据进行交互。
WebAPI has not visual elements. It's used to provide an interface that exposes methods for other applications to interact with data exposed by your WebAPI.
If you're making a website, you continue to use ASP.NET. WebAPI is entirely separate and is used for a very different purpose.
Your ASP.NET app CAN use a WebAPI to do its data manipulation, essentially using the very same interface a Windows Forms app, or a WPF app, or a mobile app uses to interact with the very same data.
这篇关于如何在Web API中创建列表视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!