Quantcast
Channel: Project Customization and Programming forum
Viewing all articles
Browse latest Browse all 5347

Hyperlink column behaviour in SharePoint JSGrid

$
0
0

Hi

I am using SharePoint JS Grid to display my data. I added 1 column in my grid which is Hyperlink column. Using following code the hyperlink gets added

public DataTable ReportTemplateData()
        {
 DataTable data = new DataTable();
            try
            {
                data = new DataTable();
                data.Locale = System.Globalization.CultureInfo.InvariantCulture;

                // Add the columns that we care about.
                data.Columns.Add(new DataColumn("Key", typeof(Guid)));
                data.Columns.Add(new DataColumn("ReportID", typeof(Guid)));
                data.Columns.Add(new DataColumn("Report Name", typeof(Hyperlink)));

                //Create snapshot row
                DataRow drTemplate;
                Service objServiceRef = new Service();
                objServiceRef.Url = ServiceURL;
                objServiceRef.Credentials = System.Net.CredentialCache.DefaultCredentials;
                DataTable reportDS = objServiceRef.GetReportTemplateList();

                foreach (DataRow reportTemplate in reportDS.Rows)
                {
                    drTemplate = data.NewRow();
                    drTemplate["Key"] = reportTemplate["ReportID"];
                    drTemplate["ReportID"] = reportTemplate["ReportID"];
                    string hyperlinkAddress;
                    hyperlinkAddress = SnapItConstants.PWAURL + SnapItConstants.REPORTTEMPLATEPAGE + "?reportTemplateName="
                         + reportTemplate["ReportName"] + "&reportType=" + reportTemplate["ReportType"] + "&editMode=true";
                        drTemplate["Report Name"] = new Hyperlink() { Display = reportTemplate["ReportName"].ToString(), Address = hyperlinkAddress};
                   data.Rows.Add(drTemplate);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return data;
 }

Then i bind resulting datatable to grid and grid displays data with hyperlink column. But i want when user clicks upon the hyperlink in the grid, the link should be opened in same page and not in new tab/page. I am not able to set this behaviour in grid.

The Hyperlink class only exposes 2 properties Hyperlink() { Display = reportTemplate["ReportName"].ToString(), Address = hyperlinkAddress}; 

I can not specify the target property. Please let me know if anyone has faced this issue and got the solution.

Thanks

Swati

 

Viewing all articles
Browse latest Browse all 5347

Trending Articles



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