473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

javascript to bind data to gridview

31
hi all programming experts,

I am developing a system using asp.net(c#) , ajax and javascripts. I want to bind a dataset to a gridview using a javascrip function. the javascript function is written in a different .js file and linked to the aspx page. i am calling that function in "onclientclick" method in a button because i want to stop post back. i am not using an update pannel. i am caaling code behind function to get the required dataset.i have successfully taken the dataset to the function but the problem is how to set the data source & call the databind method of a gridview in javascript?

Thanx
Oct 5 '07 #1
9 48375
dmjpro
2,476 2GB
hi all programming experts,

I am developing a system using asp.net(c#) , ajax and javascripts. I want to bind a dataset to a gridview using a javascrip function. the javascript function is written in a different .js file and linked to the aspx page. i am calling that function in "onclientclick" method in a button because i want to stop post back. i am not using an update pannel. i am caaling code behind function to get the required dataset.i have successfully taken the dataset to the function but the problem is how to set the data source & call the databind method of a gridview in javascript?

Thanx
Post the code you tried so far :-)

Debasis Jana
Oct 5 '07 #2
anudu
31
Post the code you tried so far :-)

Debasis Jana
this is the jscript function i am trying

Expand|Select|Wrap|Line Numbers
  1. function BindData()
  2.   {
  3.   alert('in');
  4.    var retDset=primaryInquries.TestDataSet(); //get dataset from codeBehind
  5.  
  6.   alert(retDset.value.Tables[0].Rows.length); // to check the nimber of rows
  7.  
  8.   // dataset is received correctly
  9.   document.getElementById("GridView1").DataSource=retDset; //?problem
  10.   document.getElementById("GridView1").Bind(); // ?problem. how to bind the received dataset to the grid view
  11.   return false;
  12.  
  13.  
  14.   }//end BindData
Oct 8 '07 #3
anudu
31
hi all programming experts,

I am developing a system using asp.net(c#) , ajax and javascripts. I want to bind a dataset to a gridview using a javascrip function. the javascript function is written in a different .js file and linked to the aspx page. i am calling that function in "onclientclick" method in a button because i want to stop post back. i am not using an update pannel. i am caaling code behind function to get the required dataset.i have successfully taken the dataset to the function but the problem is how to set the data source & call the databind method of a gridview in javascript?

Thanx


this is the jscript function i am trying

Expand|Select|Wrap|Line Numbers
  1. function BindData()
  2. {
  3. alert('in');
  4. var retDset=primaryInquries.TestDataSet(); //get dataset from codeBehind
  5.  
  6. alert(retDset.value.Tables[0].Rows.length); // to check the nimber of rows
  7.  
  8. // dataset is received correctly
  9. document.getElementById("GridView1").DataSource=retDset; //?problem
  10. document.getElementById("GridView1").Bind(); // ?problem. how to bind the received dataset to the grid view
  11. return false;
  12.  
  13.  
  14. }//end BindData
Oct 12 '07 #4
pronerd
392 Expert 256MB
It looks like their maybe some confusion between the lines of JavaScript and ASP.

JavaScript is clients side, it only runs on the browser, so it has no ablity to work with ASP.NET ojects like DataSets or GridViews. Browser based JavaScript can only access HTML elements in that browser instance.

It looks like you may need to post your questions in the ASP support forum.

hi all programming experts,

I am developing a system using asp.net(c#) , ajax and javascripts. I want to bind a dataset to a gridview using a javascrip function. the javascript function is written in a different .js file and linked to the aspx page. i am calling that function in "onclientclick" method in a button because i want to stop post back. i am not using an update pannel. i am caaling code behind function to get the required dataset.i have successfully taken the dataset to the function but the problem is how to set the data source & call the databind method of a gridview in javascript?

Thanx


this is the jscript function i am trying

Expand|Select|Wrap|Line Numbers
  1. function BindData()
  2. {
  3. alert('in');
  4. var retDset=primaryInquries.TestDataSet(); //get dataset from codeBehind
  5.  
  6. alert(retDset.value.Tables[0].Rows.length); // to check the nimber of rows
  7.  
  8. // dataset is received correctly
  9. document.getElementById("GridView1").DataSource=retDset; //?problem
  10. document.getElementById("GridView1").Bind(); // ?problem. how to bind the received dataset to the grid view
  11. return false;
  12.  
  13.  
  14. }//end BindData
Oct 12 '07 #5
i also have the same situation... i hope more can help here... tnx...
Oct 31 '07 #6
acoder
16,027 Expert Mod 8TB
Welcome to TSDN!
i also have the same situation... i hope more can help here... tnx...
Can you post your code? Also, explain the format of the data.
Oct 31 '07 #7
i still dont have any code... im quite new to ajax... im still thinking if its possible... my setup is like this:

i have this calender extender setup... then on its OnClientDateSelectionChanged i added a javascript... that would get the date and then using that date i will use a web service so i could get data from my database and pass it to the bindingsource... is this possible???
Nov 5 '07 #8
acoder
16,027 Expert Mod 8TB
It should be possible. See this AJAX example to get you started.
Nov 5 '07 #9
You must be looking for a data aware javascript components.

Try open source project messi.

Messi is a data aware component lib extended from ext-js lib with GNU licence, including group header grid, scrollable dataset, dataware widges, auto lookup combobox. It aims to minimize the develop cost of web database application.

Data aware widges can be auto linked to grid via a scrollable dataset. Form widges's changed value will be auto updated to dataset' last record after dataset scrolled. Also, the values of record at the new position of dataset will auto be refected to the widges.

The project is hosted on sourceforce.
Apr 28 '09 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Vijaya | last post by:
Can we bind data to textbox in a headertemplate in a template column of a datagrid? If so please give some code snippets. Thank you
3
by: vineetbatta | last post by:
I have Custom Data class which stores data about single customer and then i store that customer objects in arraylist as shown below. Customer custdata = null; // Custom Data class for 1 customer...
2
by: chandana Devabhaktuni | last post by:
Hello and Hi to everyone, This is chandana, i have a doubt which i am mentioning here. We can retrive or bind data to datagrid from database(sql server) and also we can...
1
by: sambathrajmca | last post by:
Hai, I am sambath Raj.I am new for you.Now i am trying to use windows forms with data GridView Controll.Now i am adding combobox in that data GridView but defaultly New Row Will be added next to...
1
by: newtodotnet1 | last post by:
Hi all, I would like to know how to bind data to the gridview using XPath.. The data is in the XML format.. Please help me.... Its urgent.. I am using asp.net and c#.net
1
by: jaredciagar | last post by:
Hi guys...can you help me please.... I'm using ASP.net, MSSQL 2005 and VB Script I have don't know how to bind data in gridview control from database. I want also to allow paging in gridview...
1
by: dotnetnovice | last post by:
Hi everybody... I want to show data in the data gridview placed in my form after getting data from my data access layer class through a class... Here is my code in the data access layer class....
1
by: sudha k | last post by:
how to bind data from database table to a dropdownlist nested in a gridview
0
by: vivek kapile | last post by:
This code will help for the beginners, who want to learn, how to bind a gridview. Before showing the code I will give a small introduction how to work with gridview. Add a gridview controls to...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.