Quantcast
Viewing all articles
Browse latest Browse all 17574

Opening a link in a modal dialog window

hello ,

I have created a share point webpart using c# code ( with no aspx file ). and i have a line in with i have added a link and i would like that the link should be opened in a modal dialog window like in sharePoint.

my code is :

 str2 = string.Concat(new object[] { obj2, "<p>", this.FirstWords(this.StripTagsCharArray(item[this.BodyField].ToString()), Convert.ToInt32(this.NumWords)), "... <br/><ahref=\"",web.Url, "/Lists/", this.Text, "/DispForm.aspx?ID=", item.ID, "\" >read more</a></p></div></div></div>" });

I have referenced the function that open url in modal dialog window like this : 

string str = "<script type=\"text/javascript\">function OpenDialog(URL) {var options = SP.UI.$create_DialogOptions();"+" options.url = URL; options.width = 600; options.height = 400; SP.UI.ModalDialog.showModalDialog(options);}</script>"

I would like to call my function in the href attribute of my link "red more" but i get syntax error because of special characters.

How to call this function correctly ?

Thanks.


Viewing all articles
Browse latest Browse all 17574

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>