Click here to Skip to main content
15,901,426 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am developing the client side validation on grid view . please give me the answer as soon as possible
Updated 26-Jul-12 3: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.

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 [^]
Share this answer
BillW33 26-Jul-12 10:01am    
Good advice, worth a +5.
Sandeep Mewara 26-Jul-12 13:25pm    
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;
Share this answer
momo14 1-Nov-12 11:03am    
Very Very Nice solution,
I like this.
Thank you very much
Check this article. I have explained how to make fields editable and noneditable inside gridview using checkbox.[^]
Share this answer

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

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900