?
Solved

Ajax extension for each row on gridview

Posted on 2011-03-08
6
Medium Priority
?
585 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
This article discusses how to implement server side field validation and display customized error messages to the client.
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…
Suggested Courses

752 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