469,276 Members | 1,758 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,276 developers. It's quick & easy.

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 47793
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

Post your reply

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

Similar topics

3 posts views Thread by vineetbatta | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.