Solved

Passing values from Gridview to ModalPopUp Extender

Posted on 2009-04-03
12
830 Views
Last Modified: 2013-12-17
In my project I have a Gridview with 10 Artist rows in it.
When the user clicks on one of the row a modalpopupextender is opened.
when the user clicks on the modal popup extender it will take the user to next window
based on ArtistId.
My question here is how to pass the ArtistId to Modalpopupextender when the user
clicks on the Artist row in the Gridview.
Any help will be highly appreciated.

<ItemTemplate>

	   <asp:HyperLink ID="lnkArtist" runat="server" NavigateUrl='www.yahoo.com' Text='ArtistName' />                

              <asp:LinkButton ID="lnkPopup" runat="server" Width="47px" style="display:none" />

     

                <cc1:ModalPopupExtender ID="ModalPopup1" runat="server" TargetControlID="lnkArtist"

                    PopupControlID="pnlpopup" BackgroundCssClass="modalBackground" 

                    OkControlID="btnSelect1" CancelControlID="CancelBtn" /><br />

        

		<div style="width:350px; margin:auto; margin-bottom:10px;">

                     <div style="margin-top:20px;"><strong>Do You Want To View This Artist:</strong></div>                    

                    </div>

                    

         	<div style="width:300px; margin:auto;">                                    

                   <div style="margin-top:20px; clear:both;"><asp:ImageButton ID="btnSelect2" OnClick="btnSelect2_Click" ImageUrl="~/Images/select.gif" runat="server"/> 				<strong>ClickMe</strong></div>

                   </div>

	    </asp:Panel>

	 </ItemTemplate>

Open in new window

0
Comment
Question by:ken_rgr
  • 6
  • 6
12 Comments
 
LVL 27

Expert Comment

by:nmarun
ID: 24064205
0
 

Author Comment

by:ken_rgr
ID: 24064763
I tried it. but its not working for me.
0
 
LVL 27

Expert Comment

by:nmarun
ID: 24064822
0
 

Author Comment

by:ken_rgr
ID: 24078872
I am trying in the same way
here is my script.

 function lnkArtistClick(key)
    {
        var Grid1 = document.getElementsByTagName('GridView');    //getElementById('Gridtable');
        var field1 = Grid1.getElementsByTagName('INPUT');
        for (var i = 0; i < field1.length; i++) {
            if (field1[i].type == "HiddenField") {
                alert(field1[i].value);
               
            }
        }        
    }

In the above code  document.getElementsByTagName('GridView');    is returning count 0.
I tried document.getElementById('Gridtable'); also returns null.
I dont know where I am doing mistake.
0
 
LVL 27

Expert Comment

by:nmarun
ID: 24078900
You need to something like this:

var Grid1 = document.getElementById( '<%=gridView1.ClientID %>');
0
 

Author Comment

by:ken_rgr
ID: 24079910
Hi

Thanks man. its working good now.
But I am not getting the Hidden field value now.
Basically the hidden field is in the <itemtemplate> of the gridview.
Any suggestions.
thanks
0
Highfive Gives IT Their Time Back

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 27

Expert Comment

by:nmarun
ID: 24080097
How about?
var hiddenField = document.getElementById( '<%=myHiddenField.ClientID %>');
0
 

Author Comment

by:ken_rgr
ID: 24080518
Nope , I am not getting the error "myHiddenField does not exists in the current context."
Remember Hidden field is in the Gridview. We can not access is directly.
We have to access it from Gridview only.
Please check earlier code.
Thanks
0
 
LVL 27

Expert Comment

by:nmarun
ID: 24081126
Replace 'myHiddenField' with the name you have specified in your code.
0
 

Author Comment

by:ken_rgr
ID: 24081256
Thats what I did.
0
 
LVL 27

Accepted Solution

by:
nmarun earned 500 total points
ID: 24081294
0
 

Author Closing Comment

by:ken_rgr
ID: 31566418
Appreciated your help.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
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…
This video discusses moving either the default database or any database to a new volume.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

758 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

20 Experts available now in Live!

Get 1:1 Help Now