Solved

Passing values from Gridview to ModalPopUp Extender

Posted on 2009-04-03
12
832 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ASP.NET gridview select textbox on focus 2 33
VB.NET 2008 Publish Error 2 25
Send SMS from VB via Sierra Wireless Modem 2 21
No Data for DropDown List 2 22
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

786 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