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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:57:12+00:00 2026-05-26T09:57:12+00:00

<Columns> <asp:TemplateField HeaderText=Actions ItemStyle-Width=15%> <ItemTemplate> <asp:ImageButton ID=imgbtn ImageUrl=Styles/Images/Edit.jpg runat=server Width=25 Height=25 OnClick=imgbtn_MessageEditClick Enabled=True ToolTip=Edit

  • 0
 <Columns>
                        <asp:TemplateField HeaderText="Actions" ItemStyle-Width="15%">
                            <ItemTemplate>
                                <asp:ImageButton ID="imgbtn" ImageUrl="Styles/Images/Edit.jpg" runat="server" Width="25"
                                    Height="25" OnClick="imgbtn_MessageEditClick" Enabled="True" ToolTip="Edit Message" />
                                <asp:LinkButton ID="Lnk_Delete"  CommandArgument='<%# Eval("MsgID") %>'
                                    CommandName="Delete" runat="server" >                                        <img id="Img1" src="Styles/Images/Delete.jpg" runat="server" style="border-style: none"
                                        alt="Delete Message" /></asp:LinkButton>
                                <asp:ImageButton ID="imgbtn_ViewDashBoard" ImageUrl="Styles/Images/dash.jpg" Enabled="True"
                                    Width="" runat="server" PostBackUrl='<%# Eval("MsgID", "ResponseMetric.aspx?MsgID={0}") %>'
                                    Text='Send' ToolTip="View DashBoard"></asp:ImageButton>
                            </ItemTemplate>

I have these Items templates, which is in the same column, I have another column MessageActive. In the rowDataBound if the messageActive is no then I set the row color to red, and for the same column how can I disable ImageButton ID="imgbtn" and asp:LinkButton ID="Lnk_Delete" inside the ItemTemplate.

protected void MyGrid_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        System.Web.UI.WebControls.Image img = (System.Web.UI.WebControls.Image)e.Row.FindControl("Status");
        int msgid;
        int.TryParse(Convert.ToString(DataBinder.Eval(e.Row.DataItem, "MsgID")), out msgid);            
        string status = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "MessageActive"));
        if(status.Equals("No"))
        {
            e.Row.BackColor = Color.Red;

        } 
      }
    }

I do databind for the gridview.

  • 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-26T09:57:13+00:00Added an answer on May 26, 2026 at 9:57 am
    ImageButton btnEdit = (ImageButton)e.Row.FindControl("imgbtn");
    btnEdit.Enabled = !status.Equals("No");
    LinkButton btnDelete = (LinkButton)e.Row.FindControl("Lnk_Delete");
    btnDelete.Enabled = !status.Equals("No");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<Columns> <asp:CommandField ShowDeleteButton=True ShowEditButton=True HeaderText=Edit controls ButtonType=Image DeleteImageUrl=~/Styles/Images/Delete.jpg EditImageUrl=~/Styles/Images/Edit.jpg /> <asp:TemplateField HeaderText=DashBoard> <ItemTemplate> <asp:ImageButton
I have a Gridview <asp:GridView ID=GridView1 runat=server Width=400px AutoGenerateColumns=false OnSelectedIndexChanged=GridView1_SelectedIndexChanged1> <Columns> <asp:TemplateField> <ItemTemplate> <asp:CheckBox
<asp:UpdatePanel ID=asd runat=server> <ContentTemplate> <asp:GridView ID=gvUpdate runat=server> <Columns> <asp:TemplateField HeaderText=DATE> <ItemTemplate> <asp:Label ID=lblDate runat=server
I have the the GridView's column looking like that: <Columns> <asp:TemplateField HeaderText=Opcje> <ItemTemplate> <asp:LinkButton
<asp:GridView ID=GridView1 runat=server> <Columns> <asp:TemplateField HeaderText=FileName> <ItemTemplate> <asp:HyperLink ID=HyperLink1 runat=server NavigateUrl= Text=></asp:HyperLink> </ItemTemplate> </asp:TemplateField>
<asp:GridView ID=GridView1 runat=server CssClass=style29> <Columns> <asp:TemplateField HeaderText=Send Message to Group> <ItemTemplate> <asp:LinkButton ID=LinkButton2 runat=server
<asp:GridView ID=GridView1 runat=server AutoGenerateColumns=false Height=146px Width=308px> <Columns> <asp:TemplateField HeaderText=Original Price ControlStyle-Width=100px> <ItemTemplate> <asp:TextBox ID=txtOriginalPrice
protected void GridView1_DataBound(object sender, EventArgs e) { GridView1.Columns[0].ItemStyle.Width = 400; <asp:GridView ID=GridView1 runat=server DataSourceID=ObjectDataSource1
Here is the code: <asp:GridView ID=MyGridView runat=server> <Columns> <asp:BoundField Text=Name DataField=Name /> <asp:TemplateField HeaderText=Delete>
OnRowDataBound=grdViewCInfo_RowDataBound > <RowStyle BackColor=#FFFBD6 ForeColor=#333333 /> <Columns> <asp:TemplateField HeaderText=Concert Name HeaderStyle-HorizontalAlign=Center ItemStyle-HorizontalAlign=Center ItemStyle-Width=150px ItemStyle-Wrap=true>

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.