TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Naresh Bada
NA
212
19.1k
how to visible false or true in textbox in gridview in c#
Sep 19 2019 5:58 AM
this is my code:
<asp:GridView ID="XbrlGLGrid" runat="server" Width="500px" AutoGenerateColumns="False" onrowdatabound="XbrlGLGrid_RowDataBound" >
<HeaderStyle CssClass="header" Height="15px" Width="100px" />
<FooterStyle CssClass="smallheader" />
<RowStyle CssClass="smallnavy" />
<Columns>
<asp:BoundField HeaderText="Col.No." DataField="ColNo" ItemStyle-Width="30px" HeaderStyle-Width="100px"/>
<asp:BoundField DataField="ElementName" HeaderText="RBI GL Name" ItemStyle-Horizontal ItemStyle-Width="40px" HeaderStyle-Width="100px"/>
<asp:TemplateField HeaderText="GL Code" ControlStyle-BorderWidth="1px" ItemStyle-Horizontal ItemStyle-Width="100px" HeaderStyle-Width="90px">
<ItemTemplate>
<asp:TextBox ID="txtGLCode" runat="server" CausesValidation="false" CssClass="tooltip" Width="100px" EnableViewState="true"
ToolTip="For Help, Double Click or Press F2" AutoCompleteType="Disabled" AutoPostBack="True"
OnTextChanged="txtGLCode_TextChanged"></asp:TextBox>
</ItemTemplate>
<ControlStyle BorderWidth="1px" BorderColor="Silver" />
</asp:TemplateField>
<asp:BoundField DataField="GlCode" HeaderText="Mapped GL Codes" ItemStyle-Horizontal ItemStyle-Width="200px" HeaderStyle-Width="100px" />
<asp:BoundField DataField="Amount" HeaderText="Value" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="100px" HeaderStyle-Width="110px" />
<asp:BoundField HeaderText="Enable" DataField="Enable" ItemStyle-CssClass="hiddencol" HeaderStyle-CssClass="hiddencol"/>
</Columns>
</asp:GridView>
protected void XbrlGLGrid_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.DataItem != null)
{
System.Web.UI.WebControls.TextBox txtGLCode = e.Row.FindControl("txtGLCode") as System.Web.UI.WebControls.TextBox;
string Enable = e.Row.Cells[4].Text;
if (Enable == "True")
{
txtGLCode.Enabled = false;
txtGLCode.BackColor = Color.White;
}
}
Reply
Answers (
2
)
Jquery Multi select listbox
How to create Batch Jobs in Asp.Net Core Console Application