subash
subash

Reputation: 4137

image button beside each record 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?

Upvotes: 0

Views: 405

Answers (1)

Wil
Wil

Reputation: 2368

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>

Upvotes: 1

Related Questions