TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
prasanth kanna
NA
10
1.3k
Javascript Button click Issue
Jun 30 2014 9:14 AM
Hi Gurus,
Please find the code below:
Default.aspx
<asp:LinkButton ID="lnk1" runat="server" Text="Redirect" PostBackUrl="~/Default2.aspx?CustomerId=1&ItemId=1"></asp:LinkButton>
Default2.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function Loadpage(lnk) {
try {
//reload page using new page size
var url = document.URL;
var index = lnk;
if (url.indexOf('Index') > 0) {
index = url.split('?')[1];
index = index.split('&')[0];
}
url = url.split('?')[0] + "?" + "Page=" + index;
window.location.href = url;
} catch (e) {
alert(e);
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:LinkButton ID="lnk1" runat="server" Text="1" OnClientClick="javascript:Loadpage(1);return false;"></asp:LinkButton>
<asp:LinkButton ID="lnk2" runat="server" Text="2" OnClientClick="javascript:Loadpage(2);return false;"></asp:LinkButton>
<asp:LinkButton ID="lnk3" runat="server" Text="3" OnClientClick="javascript:Loadpage(3);return false;"></asp:LinkButton>
<asp:LinkButton ID="lnk4" runat="server" Text="4" OnClientClick="javascript:Loadpage(4);return false;"></asp:LinkButton>
<asp:LinkButton ID="lnk5" runat="server" Text="5" OnClientClick="javascript:Loadpage(5);return false;"></asp:LinkButton>
<asp:LinkButton ID="lnk6" runat="server" Text="6" OnClientClick="javascript:Loadpage(6);return false;"></asp:LinkButton>
<asp:LinkButton ID="lnk7" runat="server" Text="7" OnClientClick="javascript:Loadpage(7);return false;"></asp:LinkButton>
<asp:LinkButton ID="lnk8" runat="server" Text="8" OnClientClick="javascript:Loadpage(8);return false;"></asp:LinkButton>
<asp:LinkButton ID="lnk9" runat="server" Text="9" OnClientClick="javascript:Loadpage(9);return false;"></asp:LinkButton>
<asp:LinkButton ID="lnk10" runat="server" Text="10" OnClientClick="javascript:Loadpage(10);return false;"></asp:LinkButton>
</div>
</form>
</body>
</html>
1) I am redirecting from Default.aspx page with querystring,It looks like this:
eg: http://localhost/Default2.aspx?CustomerId=1&ItemId=1
2)In Default2.aspx,I have buttons 1 to 10 (pasted above).
3)If i click on those button,it should attach to the querystring in the url:
eg: http://localhost/Default2.aspx?CustomerId=1&ItemId=1&Page=1
4) But now my issue is : if i click on 1st button - url changes to
eg: http://localhost/Default2.aspx?Page=1
5) i wanted the url like
http://localhost/Default2.aspx?CustomerId=1&ItemId=1&Page=1
and the page number should change based on the button clicked.
How to achieve this. Please help me with this.
Thanks in Advance.
Reply
Answers (
1
)
How to get client machine MAC address
How to stop log4net from creating two log files