I am using the javascript function to get the selected row value in a grid. Now i want these selected value into another .aspx page using javascripting or jquery. Can you please tell me how to pass values using javascript i can't do server side coding.
Here is my javascript function which i am using to get the values:
var gridClientId = '<%=Grid1.ClientID %>';
$(document).ready(function () {
$('#' + gridClientId + ' tbody tr').click(function () {
var selectedItems = Grid1.GetSelectedItems();
for (var i = 0; i < selectedItems.length; i++) {
var year = $.trim((selectedItems[i].Cells[0].Value));
var jan = $.trim((selectedItems[i].Cells[2].Value));
var Feb = $.trim((selectedItems[i].Cells[3].Value));
var Mar = $.trim((selectedItems[i].Cells[4].Value));
var May = $.trim((selectedItems[i].Cells[5].Value));
document.getElementById('<%=hf1.ClientID%>').value = year;
document.getElementById('<%=hf2.ClientID%>').value = jan;
document.getElementById('<%=hf3.ClientID%>').value = Feb;
document.getElementById('<%=hf4.ClientID%>').value = Mar;
}
});
}); Now i want these hiddenfield values in another .aspx page . Please help me.
Just Create one aspx page in order to handle ajax request. Now send your selected row value to this page using Ajax and store that value in session during the oage load event of this page.
when you navigate to another page, just fecth selected row value from session.
deepikavishn...
Member
36 Points
25 Posts
Pass the javascript object values into another page using jquery or javascript
Mar 01, 2012 04:59 AM|LINK
Hello,
I am using the javascript function to get the selected row value in a grid. Now i want these selected value into another .aspx page using javascripting or jquery. Can you please tell me how to pass values using javascript i can't do server side coding.
Here is my javascript function which i am using to get the values:
var gridClientId = '<%=Grid1.ClientID %>';
$(document).ready(function () {
$('#' + gridClientId + ' tbody tr').click(function () {
var selectedItems = Grid1.GetSelectedItems();
for (var i = 0; i < selectedItems.length; i++) {
var year = $.trim((selectedItems[i].Cells[0].Value));
var jan = $.trim((selectedItems[i].Cells[2].Value));
var Feb = $.trim((selectedItems[i].Cells[3].Value));
var Mar = $.trim((selectedItems[i].Cells[4].Value));
var May = $.trim((selectedItems[i].Cells[5].Value));
document.getElementById('<%=hf1.ClientID%>').value = year;
document.getElementById('<%=hf2.ClientID%>').value = jan;
document.getElementById('<%=hf3.ClientID%>').value = Feb;
document.getElementById('<%=hf4.ClientID%>').value = Mar;
}
});
}); Now i want these hiddenfield values in another .aspx page . Please help me.
Thanks,
kedarrkulkar...
All-Star
35563 Points
5700 Posts
Re: Pass the javascript object values into another page using jquery or javascript
Mar 01, 2012 05:11 AM|LINK
few options...
either form a querystring using these values and call a new page by passing these values in querystring....
or, call a server side method from javascript here (asynch).... pass all the values to server method and set session variables on server side...
then simply redirect user to new page from javascript..... and read values from session variable in new page...
hope this helps...
KK
Please mark as Answer if post helps in resolving your issue
My Site
farukinfo
Participant
1694 Points
350 Posts
Re: Pass the javascript object values into another page using jquery or javascript
Mar 01, 2012 05:15 AM|LINK
Please make it clear how are you moving to other page, if from using javascript then add these values to url using query string.
Faruk
Please mark as Answer if it helps.
deepikavishn...
Member
36 Points
25 Posts
Re: Pass the javascript object values into another page using jquery or javascript
Mar 01, 2012 05:43 AM|LINK
I am moving to another page like this:
I am using component art tools so my procedure of coding is bit different. I can't use url in clientside it should be server side.
<ServerTemplates>
<ComponentArt:GridServerTemplate ID="GridServerTemplateyear">
<Template>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# ("~/Customer.aspx?YEAR=1")%>'><%#(Container.DataItem["YEAR"].ToString())%></asp:HyperLink>
</Template>
</ComponentArt:GridServerTemplate>
</ServerTemplates>
Now, when i nevigate to another page then i need those values too which i already described you on my previous post.
harshanand
Member
73 Points
38 Posts
Re: Pass the javascript object values into another page using jquery or javascript
Mar 01, 2012 04:51 PM|LINK
Just Create one aspx page in order to handle ajax request. Now send your selected row value to this page using Ajax and store that value in session during the oage load event of this page.
when you navigate to another page, just fecth selected row value from session.