Solved

Ajax extension for each row on gridview

Posted on 2011-03-08
6
579 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

The most up-to-date version of this article is on my Blog https://iconoun.com/blog/
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…

726 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