First download the request from mongodb as follows:
var server = MongoServer.Create("mongodb://localhost:27020"); var database = server.GetDatabase("someDb"); var collection = database.GetCollection<User>("someCollection"); var searchQuery = Query.EQ("someName", "someValue");
Then, in the Page_Load event, bind the data:
gvwExample.DataSource = resultList; gvwExample.DataBind();
Then specify the data source binding on the page:
<asp:GridView ID="gvwExample" runat="server" AutoGenerateColumns="False" CssClass="basix" > <columns> <asp:BoundField DataField="FirstName" HeaderText="First Name" /> <asp:BoundField DataField="LastName" HeaderText="Last Name" /> </columns> </asp:GridView>
source share