Solved

Ajax extension for each row on gridview

Posted on 2011-03-08
6
557 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

jQuery is a JavaScript library that greatly simplifies JavaScript programming. AJAX is an acronym formed from "Asynchronous JavaScript and XML."  AJAX refers to any communication between client and server, when the human client does not observe a…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now