Sunday 29 October 2017

Retrieve values from GridView on SelectedIndex_changed

This is very different from rowindex_changed

For C#

Find the control, probably a label, of the data you want to retrieve.

    //Accessing BoundField Column
    string name = GridView1.SelectedRow.Cells[0].Text;
 
    //Accessing TemplateField Column controls
    string country =       (GridView1.SelectedRow.FindControl("lblCountry"as Label).Text;
 
    lblValues.Text = "<b>Name:</b> " + name + " <b>Country:</b> " + country;

An error occurred during local report processing in RDLC

I had this issue during the week and I have decided to put this as an article in my personal knowledge bank.

I tried to convert RDLC to PDF: it worked on my local machine but on getting to Azure I got this error: "An error occurred during local report processing in RDLC".

I didn’t  achieve this on Azure but I was able to resolve the issue using these instructions
  1. Add Microsoft Report Viewer dll to your solution( ReportViewer.common, ReportViewer.webform and ReportViewer.project object model)
  2. The dll must be of the same version.
  3. Set the “copy to local” property to true for all DLLs. (this is done so that the DLLs will be published with the solution).
  4. Install Microsoft Report Viewer Runtime same or higher version.
  5. Set the “BuildAction” property to content and make sure the name of the Report is the same as the name of the Report you want to use
  6. Set the “Copy to Output Director” property to “copy always” or “copy if newer”

Build and publish your project, the Report appears in the bin folder. I used another Host for the project and all was fine.