Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Ajax extension for each row on gridview

Posted on 2011-03-08
6
Medium Priority
?
589 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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
Course of the Month20 days, 15 hours left to enroll

810 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