Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Thursday, October 1, 2015 8:28 AM
Hi All,
I have create a visual webpart with grid view which displays custom list information with few fields.
I have a requirement to display splist item information on grid view link button click or lable with href tag in a model dialog.
Can some one please help me.
MercuryMan
All replies (3)
Friday, October 2, 2015 7:01 AM âś…Answered
Hi MercuryMan,
As your description, you want to display list item on link button click in SharePoint 2010.
For doing it, I suggest you use SP.UI.ModalDialog method.
More information about SP.UI.ModalDialog:
There is an example, please take a look at:
Best Regards,
Wendy
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected].
Friday, October 2, 2015 7:18 AM
hey,
simple way of doing it and mostly same as suggested by Wendy:
add Js in website:
<script>
function openDialog( pageUrl ) {
SP.UI.ModalDialog.showModalDialog( {
url: pageUrl,
width: 600,
height: 800,
title: "Pop up window title"
} );
}
//jQuery bit
$(document).ready(function(){
$("a.myClass").click(function(){
openDialog( 'enter full link to destination');
});
});
</script>
2.
Add HTML class to link\button\image same as defined (can be any you want) in step 1, in this case its class="myClass" on tag <a></a>:
<a class="myClass">link title</a>
clicked on the link will pop up with destination page inside.
Monday, October 5, 2015 8:37 AM
Hi Wendy,
I have used the code from the links you shared and added below code to grid view and it worked.
<asp:TemplateField HeaderText="Requested Data">
<ItemTemplate>
<input onclick="javascript:SP.UI.ModalDialog.showModalDialog({ url: '../Lists/DataBank/UpdateForm.aspx?ID=<%# Eval("ID") %>&IsDlg=1', title: 'Data Requested : <%# Eval("Reference Number") %>' }); return false;" id="btnVote" type="button" value="View" />
</ItemTemplate>
</asp:TemplateField>
MercuryMan