开发者

image button beside each record in a grid

开发者 https://www.devze.com 2022-12-18 13:32 出处:网络
iam working on asp.net &c# i am working on the following scenario. i have two records ajay and mike in a grid.

iam working on asp.net &c#

i am working on the following scenario.

i have two records ajay and mike in a grid.

requirement:i need a image button to be displayed beside their names such that on clicking the button it will have common functionality for both records.

if i click on the button 开发者_运维技巧beside ajay it displays a div with all hyperlinks of ajay

if i click on the button beside mike it displays a div with all hyperlinks of mike

also the button should not be displyed for all the records,it should be displayed only for particular users

can anyone guide me?


You can use ImageButton with TemplateFields to achieve this.

<asp:GridView id="gridview" runat="server">
    <Columns>
    <asp:TemplateField>
    <ItemTemplate>
    <asp:ImageButton ID="ImageButton1" runat="server" OnClientClick='OpenDiv(); return false;' />
    </ItemTemplate>
    </asp:TemplateField>
    </Columns>
    </asp:GridView>

    <script language="javascript" type="text/javascript">

       function OpenDiv(){
          // do whatever here to open div based on the id
          return false;
       }

    </script>
0

精彩评论

暂无评论...
验证码 换一张
取 消