?
Solved

Passing values from Gridview to ModalPopUp Extender

Posted on 2009-04-03
12
Medium Priority
?
843 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
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 

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 1500 total points
ID: 24081294
0
 

Author Closing Comment

by:ken_rgr
ID: 31566418
Appreciated your help.
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

839 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