2
DocumentViewer can be used in a grid, but ID naming convention is breaking it.
Problem reported by Tony Phan - 11/22/2016 at 8:26 AM
Submitted
I added the DV control on a grid and it loaded the documents just fine.  The only problem is, if there were 4 rows, it loads all four documents on the very first DV defined.  As it turned out, it's because the ID is static but I already tried other ClientIDMode settings, none seems to work.  As a work-around, I was able to rely on the RowDataBound event to rename and got the documents to load correctly like this:
 
    if (e.Row.RowType == DataControlRowType.DataRow) {      
      var dv = e.Row.FindControl("dvDocViewer") as GleamTech.DocumentUltimate.Web.DocumentViewer;
      dv.ID = "dvDocViewer_" + (e.Row.DataItem as DataRowView)["No_"].ToString();
      dv.Document = MapPath((e.Row.DataItem as DataRowView)["File Link"].ToString());
    }
 

Reply to Thread