Thursday, 20 March 2014

Create auto generated column number in gridview

Its very nice to get the auto generated column number in grid it will work like the serial number for grid with respect to the auto generated number in grid call the server side method in c# file and binding images into the grid. HTML Code   <tr>        <td style="height: 5px" width="10%" align="center">  <img src='<%# GetText(Container.DataItemIndex + 1) %>' alt='<%# Container.DataItemIndex + 1 %>' /> </td><td style="width: 3px"></td>                                                               Container.DataItemIndex + 1 its generated the unique value. C# Code GetText(Container.DataItemIndex + 1)    GetText is calling the server side method. server side Code The method defined in server side it should be  public and returning the string value.   public string GetText(int PropertyId)     {         return @"Images/Number/" + PropertyId + ".jpg";     } by this method code is returning the image link already present in application. Sample as it display :  it will be display like below image

No comments:

Post a Comment