Click here to Skip to main content
15,900,511 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I want to bind sql server table into a gridview in asp.net Through JSON.Directly from database.

Note:without webmethod

What I have tried:

I tried with jquery or json ajax method.but its wrong one.i want to use JSON only to pass data from sql table to display gridview.
Posted
Updated 16-May-17 8:11am
Comments
F-ES Sitecore 16-May-17 6:53am    
A gridview is a server-side component, you can't bind to it on the client via javascript. If you only want the basic table layout for your data then simply create a normal table (google "create table json" for examples), don't use a gridview.

1 solution

There's no chance to bind json object to gridview directly! You have to deserialize json object (data) to DataTable then you'll be ale to bind json data with gridview. See:
c# - Bind JSON string to Gridview - Stack Overflow[^]
 
Share this answer
 
Comments
GrpSMK 17-May-17 1:25am    
Thank you
Maciej Los 17-May-17 7:00am    
You're very welcome.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900