1

i just cant figure why it makes this error. when i run the below codes. the jquery function works but the text revert back to what it was before clicking.please help.

<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="ViewListOfProjects.aspx.cs" Inherits="Final_Year_Project_Allocation_System.Stud.ViewListOfProjects" EnableSessionState="True" EnableViewState="False" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="SideBarContent" runat="server">
    <div class="well">
        <ul class="nav nav-list">
            <li class="nav-header">Student Menu</li>
            <li><a href="RegisterTeam.aspx">Home</a></li>
            <li><a href="student_project_choice.aspx">Select Project</a></li>
            <li class="active"><a href="ViewListOfProjects.aspx">View Project Proposal</a></li>
            <li><a href="ViewAllocatedProject.aspx">View allocated project</a></li>
            <li><a href="MscProjectProposalForm.aspx">Propose Project</a></li>
            <li><a href="ChangePassword.aspx">Change Password</a></li>
        </ul>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="BodyContent" runat="server">
        <div class="navbar navbar-inverse navbar-fixed-top">
        <div class="navbar-inner">
            <div class="container-fluid">
                <a class="btn btn-navbar"></a><a class="brand" href="#">Project Allocation System</a>
                <div class="nav-collapse collapse">
                    <p class="navbar-text pull-right">
                        Logged in as
                        <asp:Label ID="lblUsername" runat="server"></asp:Label>
                        <asp:LinkButton ID="btnLogout" runat="server" onclick="btnLogout_Click">Logout</asp:LinkButton>
                    </p>
                </div>
            </div>
        </div>
    </div>
    <asp:Label ID="lblMessage" runat="server" Text=""></asp:Label>
    <div class="pull-right">
    <asp:Label ID="lblPdf" runat="server" Text="View In PDF format" CssClass="label label-info"></asp:Label>
    <asp:ImageButton ID="btnPdf" 
            ImageUrl="~/Images/Adobe-PDF-Document-icon.png" Height="60px" Width="60px" runat="server" OnClientClick="redirect();"/>
    <br/><br/>
    </div>

<div id="pdfContent">
    <p></p>
</div>

<asp:PlaceHolder ID="projectHolder" runat="server"></asp:PlaceHolder> 

<script language="javascript" type="text/javascript">
    function redirect() {
        $('p').text("ss");
}

i want the text to contain the "ss" from the jquery function and it stays that way.

1
  • If you have no dependent functionality on server for asp:ImageButton use simple html img tag to avoid any postbacks. Commented May 19, 2013 at 7:51

1 Answer 1

3

Try setting the on client click for btnPdf like this:

OnClientClick="redirect(); return false;"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.