Solved

Ajax extension for each row on gridview

Posted on 2011-03-08
6
570 Views
Last Modified: 2012-05-11
I'm trying to use the animation extension from ajax to populate with data from a selected row in my gridview. Using the code below which I found on the web, it works fine  when  I select a control that is not part of the gridview. i.e

 <asp:LinkButton ID="lnkBtnColHelp" runat="server" Text="Click Here" OnClientClick="return false;" />

If I create a column with a button in my gridview and choose the targetcontrolID to be the button, the animation extension does not recognise the control.

Ideally I wouldn't even like to have a button, i would like to select anywhere on the row and then populate the animation with any cell in that row.

Any help would be appreciated.
<asp:AnimationExtender ID="AnimationExtender1" runat="server" TargetControlID="lnkBtnColHelp">
            <Animations>
                <OnClick>
                    <Sequence>
                        <EnableAction Enabled="false"></EnableAction>
 
                        <StyleAction AnimationTarget="moveMe" Attribute="display" Value="block"/>
                        <Parallel AnimationTarget="moveMe" Duration=".5" Fps="30">
                            <Move Horizontal="0" Vertical="0"></Move>
                            <FadeIn Duration=".5"/>
                        </Parallel>
                        <Parallel AnimationTarget="moveMe" Duration=".5">
                             <Color PropertyKey="color" StartValue="#666666" EndValue="#FF0000" />
                            <Color PropertyKey="borderColor" StartValue="#666666" EndValue="#FF0000" />
                        </Parallel>
                    </Sequence>
                </OnClick>
            </Animations>
       
        </asp:AnimationExtender>
       
        <asp:AnimationExtender ID="AnimationExtender2" runat="server" TargetControlID="lnkBtnCloseColHelp">
       
            <Animations>
                <OnClick>
                    <Sequence AnimationTarget="moveMe">
                        <Parallel AnimationTarget="moveMe" Duration=".7" Fps="20">
                            <Move Horizontal="0" Vertical="0"></Move>
                            <Scale ScaleFactor="0.05" FontUnit="px" />
                            <Color PropertyKey="color" StartValue="#FF0000" EndValue="#666666" />
                            <Color PropertyKey="borderColor" StartValue="#FF0000" EndValue="#666666" />
                            <FadeOut />
                        </Parallel>
                        <StyleAction Attribute="display" Value="none"/>
                        <StyleAction Attribute="height" Value=""/>
                        <StyleAction Attribute="width" Value="400px"/>
                        <StyleAction Attribute="fontSize" Value="14px"/>
                        <EnableAction AnimationTarget="lnkBtnColHelp" Enabled="true" />
                    </Sequence>
                </OnClick>
            </Animations>
       
</asp:AnimationExtender>

Open in new window

0
Comment
Question by:Michael Roodt
  • 4
  • 2
6 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35083580
I believe that the problem you are having is that the extender needs to find the control, and it can't because the GridView is a naming container, and adds additional parts to the control ID.  Look at the render page, and see how the unique ID is generated for each row in the GridView.
0
 
LVL 2

Author Comment

by:Michael Roodt
ID: 35107273
Thanks,

Are you able to provide me an example of how to do this please.

Thanks
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35109982
I can't quite see how the GridView is configured, and what your page hierarchy looks like (master page, panels, etc).  Can you show me how the GridView is configured in HTML, please?
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 2

Author Comment

by:Michael Roodt
ID: 35146886
Sorry for the late reply,  I added an example below, there is one gridview with a few rows that is populated from the code behind. There is also a button on the webpage. Currently when you select the button, the animation extender works, I would like to select the row on the gridview and it do  the same thing. That's what I'm struggling with.

Thanks
Default.aspx
Default.aspx.vb
0
 
LVL 2

Accepted Solution

by:
Michael Roodt earned 0 total points
ID: 35165495
I've found a soloution using the code below
<asp:Button runat="server" ID="btnShowModalPopup" style="display:none"/>

    <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" 
    TargetControlID="btnShowModalPopup"
    PopupControlID="divPopUp" 
    BackgroundCssClass="popUpStyle" 
    PopupDragHandleControlID="panelDragHandle"
    DropShadow="true">
    </asp:ModalPopupExtender>
<br />
 
<div class="popUpStyle" id="divPopUp" style="display:none;">
    <asp:Panel runat="Server" ID="panelDragHandle" CssClass="drag">
        Hold here to Drag this Box
    </asp:Panel>
    <asp:Label runat="server" ID="lblText" Text=""></asp:Label>
    <asp:Label ID="lblCustValue" runat="server"></asp:Label>
    <asp:GridView ID="GridView2" runat="server">
    </asp:GridView>                          
    <asp:Button ID="btnClose" runat="server" Text="Close" />
   <br />
</div>

Open in new window

Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles StockAdjustmentGridView.SelectedIndexChanged
        Dim row As GridViewRow = StockAdjustmentGridView.SelectedRow
        StockAdjustmentVendaResults(row)

        lblCustValue.Text = info
        ModalPopupExtender1.Show()


    End Sub

Open in new window

0
 
LVL 2

Author Closing Comment

by:Michael Roodt
ID: 35196644
Found my own solution
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question