Thursday 5 April 2018

Shift TemplateField in gridview autogeneratecolumns in last column of the row asp.net

//////////////////////HTML

<asp:GridView runat="server" ID="GV_PersonalAttributes" AutoGenerateColumns="true"
    OnRowDataBound="GV_PersonalAttributes_RowCreated">
     <Columns>
      <asp:TemplateField HeaderText="Attributes">
       <ItemTemplate>
         <asp:LinkButton runat="server" ID="lbtn_EditObjective" Text="Edit"></asp:LinkButton>
         </ItemTemplate>
        </asp:TemplateField>
       </Columns>
    </asp:GridView>


/////////////CS


protected void GV_PersonalAttributes_RowCreated(object sender, GridViewRowEventArgs e)
    {
        TableCell cell = e.Row.Cells[0];
        e.Row.Cells.RemoveAt(0);
        e.Row.Cells.Add(cell);
    }

No comments:

Post a Comment

Excel Sort values in ascending order using function TEXTJOIN

 Excel ::  Text ::  1,3,5,2,9,5,11 Result :: 1,2,3,5,5,9,11 Formula ::     TEXTJOIN ( ",",1,SORT(MID(SUBSTITUTE( A1 ,","...