<asp:TemplateField HeaderText="My Readonly Textbox"> <ItemTemplate> <asp:TextBox ID="txtReadOnly" runat="Server" ReadOnly="true"></asp:TextBox> </ItemTemplate> </asp:TemplateField>
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e){ if (e.Row.RowType == DataControlRowType.DataRow) { var txt = (TextBox)e.Row.FindControl("txtReadOnly"); if(txt !=null) { txt.Attributes.Add("readonly", "readonly"); } }}
-- Thanks & Regards, RNA Team
Feel free to share informations. mail Id ' adityagupta200@gmail.com Thanks
Login to post response