tags:

views:

85

answers:

1

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?

A: 

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>
Wil
but i do want to show the button only for certain records but how can i do that?i was just able to get up to onrowdatabound evenyt,and was struck in h functionality of showing the imagebutton fro the particular user
subash
in the rowdatabound event, just do a ImageButton btn = (ImageButton)e.Row.FindControl("ImageButton1")btn.Visible = false
Wil
thank u wil,i was able to get that?,also Wil, iam just adding the alt text for the image in the rowdatabound event ? is it possible for me to retreive the alt text at the mouse over event ?
subash