Click here to Skip to main content
13,343,856 members (75,020 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I am developing the client side validation on grid view . please give me the answer as soon as possible
Posted 26-Jul-12 4:08am
Updated 26-Jul-12 4:32am
Vani Kulkarni 26-Jul-12 9:33am
Removed urgency.
Vani Kulkarni 26-Jul-12 9:35am
What have you tried till now? Post the specific code where you are facing issue.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Did you try anything? Please do make an effort, you may find it's not that difficult.

These articles will help you to learn:
JQuery to Enable and Disable Textbox when CheckBox is Checked with Gridview [^]
Check/uncheck CheckBox in a GridView using Javascript[^]
Enable textbox in gridview on click checkbox [^]
CIDev 26-Jul-12 10:01am
Good advice, worth a +5.
Sandeep Mewara 26-Jul-12 13:25pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 4

Giving you a ready sample. Say below is your grid view

<asp:GridView ID="gvM" runat="server">
                    <asp:CheckBox runat="server" ID="chkIs" onclick="GetCheckStatus()"></asp:CheckBox>
                    <asp:TextBox runat="server" ID="txtId"></asp:TextBox>
            <asp:BoundField AccessibleHeaderText = "Name" DataField="Name" />

Have a script which will be called every time when the ckeck box is checked or unchecked.
<script language="javascript" type="text/javascript">
function GetCheckStatus() {
 var srcControlId =;
 var targetControlId ='chkIs', 'txtId');
 if (document.getElementById(srcControlId).checked)
      document.getElementById(targetControlId).disabled = false;
      document.getElementById(targetControlId).disabled = true;

In your aspx.cs page bind the grid with appropriate data source as below.
protected void Page_Load(object sender, EventArgs e)
DataTable dt = new DataTable();
DataRow dr = dt.NewRow();
dr["Name"] = "Das";
DataRow dr1 = dt.NewRow();
dr1["Name"] = "Shon";
gvM.DataSource = dt;
momo14 1-Nov-12 11:03am
Very Very Nice solution,
I like this.
Thank you very much
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Check this article. I have explained how to make fields editable and noneditable inside gridview using checkbox.[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.180111.1 | Last Updated 26 Jul 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100