Solved

Passing values from Gridview to ModalPopUp Extender

Posted on 2009-04-03
12
835 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
[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
  • 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
Industry Leaders: 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!

 

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
 
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

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…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

724 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