Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 446481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T21:28:30+00:00 2026-05-12T21:28:30+00:00

I have a GridView with a few columns. One of the columns is a

  • 0

I have a GridView with a few columns. One of the columns is a button. It is in a template field which looks like this:

<asp:TemplateField>
<ItemTemplate>
    <asp:Button ID="btnApply" Text="View Details" CssClass="viewdetails" runat="server"/>
</ItemTemplate>
</asp:TemplateField>

My JQuery code is as follows:

<script type="text/javascript">
    $(document).ready(function() {
        $('.viewall, .viewdetails').click(function() {
          alert('Must be a member to view all');
        });
    });
</script>

When I first visit the page and click the view details button, the alert pops up, but after that, if I click any other view details button, it does not popup until the page is refreshed. The View All button displays the message all the time because when I click that, the page is refreshed.

A couple notes. The View Details button is inside an asp.net GridView and the GridView is inside an asp.net UpdatePanel.

Also, since view all and viewdetails calls the same message, is there a way to combine them into one click event, for example, $(‘.viewall .viewdetails’).click(…….

If I remove the update panel, it works, but everytime I click View All or View Details, I get a flicker, so I added a return false; and this stopped the flicker, however, this prevents the user from going to the Member page if they are indeed logged in. If I take the return false off and they are signed in, the message still popsup and then takes them to the Member Page. This is obviously not supposed to happen, but I am not sure how to handle it. Basically the events should be:

If the user is not logged in and they click the View all or View details button, display a message saying they must sign in or become a member.

If the user is logged in and they click the View all or View details button, redirect them to the Members Page. Both View All and View Details have server side click events which do a Response.Redirect to the Members Page if they are logged in.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T21:28:31+00:00Added an answer on May 12, 2026 at 9:28 pm

    You need to cancel the click event in these cases…

        $(document).ready(function() {
            $('.viewall').click(function(e) {
              alert('Must be a member to view all');
              e.preventDefault();
            });
            $('.viewdetails').click(function(e) {
              alert('Must be a member to view all');
              e.preventDefault();
            });
        });
    

    You can use multiple selectors by delimiting them with a comma…

        $(".selector1, .selector2").click(function() { ... });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have an asp:GridView that displays a few BoundFields and then one asp:TemplateField
I have a gridview which contains few Template columns, In the first Template column
I have a gridview on which Item template has few textbox, due to business
I currently have an ASP.NET GridView that displays a few columns to the user
Need help pretty soon on this..... I have a Gridview in which the columns
I have a GridView like this( main.xml ): <?xml version=1.0 encoding=utf-8?> <GridView xmlns:android=http://schemas.android.com/apk/res/android android:id=@+id/gridView1
I have a gridview which contains columns vacancy id and vacancy title and a
I have a Sharepoint list which have columns like : CopmanyName, Add1, Add2 Country,
I have a webform gridview. In that one columns is password. I want to
I have a button in EmptyTempletField of gridview for which causevalidation property is set

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.