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 7061529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:29:07+00:00 2026-05-28T04:29:07+00:00

I am having so much trouble with this. I have looked everywhere so I

  • 0

I am having so much trouble with this. I have looked everywhere so I hope someone can either explain to me how to do this or show me. Here’s my problem:

I have a DataGrid filled with DataBound Items (ItemTemplate) which was created using ASP.Net.

My reason for the ItemTemplates over a regular DataBound field is to enable the Edit Mode of the DataGrid. In my ItemTemplates, I have labels to display the data and two option buttons (Edit/Delete). I’ve got the buttons working in the code behind (C#).

Edit places the DataGrid in Edit Mode. In the EditItemTemplates I’ve got DropDownLists, TextBoxes, and a Save button in place of the Edit button.

The Save button also works with the code I’ve written for it. All-in-all, the DataGrid works beautifully and displays everything neatly. However, there is one final job I want the Save button to do: I want it to check the TextBoxes and validate that the values entered match the criteria I have set (keep in mind that these are in EditItemTemplates).

I have Javascript already written that will check for validation. I want a modal window (that I have already set up) to display and I want the CSS of the TextBoxes in question to change.

I want to do this using Javascript but my problem is that I can’t check for the Save button to create the Click event and I can’t ‘locate’ the TextBoxes to validate them. Is there a way I can ‘find’ those elements while the DataGrid is in Edit Mode?

Here’s a small bit of the code used to create the DataGrid if it helps:

<asp:DataGrid ID="dgCamsizer" CssClass="data" runat="server" AutoGenerateColumns="False"
                GridLines="None" OnItemCommand="dgCamsizer_ItemCommand" ShowHeader="true">
                <Columns>
                    <asp:TemplateColumn HeaderStyle-CssClass="infoHeaderDG">
                        <HeaderTemplate>
                            Operator</HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Operator" Text='<%# DataBinder.Eval(Container.DataItem, "Operator") %>'
                                runat="server" /></ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="EditOper" Width="40px" Text='<%# DataBinder.Eval(Container.DataItem, "Operator") %>'
                                runat="server"></asp:TextBox></EditItemTemplate>
                        <HeaderStyle CssClass="infoHeaderDG"></HeaderStyle>
                    </asp:TemplateColumn>

                    <asp:TemplateColumn HeaderStyle-CssClass="infoHeaderDG">
                        <ItemTemplate>
                            <asp:Button ID="Edit" Text="Edit" CommandName="Edit" runat="server" /></ItemTemplate>
                        <EditItemTemplate>
                            <asp:Button ID="Save" Text="Save" CommandName="Save" runat="server" /></EditItemTemplate>
                        <HeaderStyle CssClass="infoHeaderDG"></HeaderStyle>
                    </asp:TemplateColumn>
     </Columns>
</asp:DataGrid>

Perhaps I should re-phase my question: I managed to ‘find’ the TextBoxes thanks to Zetlen. I’ve also managed to get the values. Now… How do I use those values to test for validation?

Here is the code I used to get the values:

$("#<%=dgCamsizer.ClientID %> :text").each(function () {
                        alert($(this).val());
                    });
  • 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-28T04:29:08+00:00Added an answer on May 28, 2026 at 4:29 am

    So I managed to solve my own problems and answer my own question. I was able to get the id’s of all of the TextBoxes and I even placed them into an array to be used for my validations. Here’s what I used to do all of this:

    var i = 0;
    var data = [];
    $("#<%=dgCamsizer.ClientID %> :text").each(function () {
      data[i] = $(this).attr("id");
      i++;
     });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can't believe how much trouble I am having finding this: I want to
I'm having a little trouble with this and can't see what I'm doing wrong.
This may be too much trouble, but I have an object I'm trying to
I'm having some trouble figuring out the right way to do this: I have
I am having so much trouble with this site! http://pearsonlyle.uwpistol.net/galleries/susie-theodorou/editorial/ The navigation that is
I don't know why I'm having so much trouble searching this, it seems really
Hello I'm having trouble figuring this out. I have these structs and classes. struct
I am having trouble getting this accomplished. I have one formset with 5 extra
I'm having a bit of trouble figuring this one out. I have a dropdownlist
Ugh - not sure why I'm having so much trouble with this. Writing a

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.