You must Sign In to post a response.
  • Category: ASP.NET

    Changing a GriedView Field Column as LinkButton during Runtime

    Hi Guys,

    I am loading a grid of four fields. And only at one scenario, i want a column values as linkbutton. For other seniors, it will displayed as normal . So i want to convert a particular GridView column values as linkbutton at runtime after binding values to gridview. Help me to solve this.

    Rajabharathi R.
  • #764033

    In design 2 separate templates one with linkbutton and another with label control.


    Design 1 template and include both label and linkbutton controls in same template.

    Now, onrowdatabound event of grid view based on condition you can enable or disable controls as you want.

    Give respect to your work, Instead of trying to impress your boss.

    Blog :

  • #764040
    Hai Rajabharathi,
    First of all, take a template column for this and add a link button to this column. Then you can use the RowDataBound event handler to do this. In this event handler, check your value/condition for which you want to convert this button to link. if you provide the href, it will be linked button, else it will be simple non clickable as label.
    Hope it will be helpful to you.

    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)

  • #764118
    you need to use template field and in item template and put a link button or hyperlink and bind its url like as "<%#''+Eval("field").ToString()%>" and bind its text accordingly. Hope it will help you.
    If you are unable to do something properly for the first time, call it Version 1.0!

    Thanks & Regards,

  • Sign In to post your comments