c# - How do you pass data source to a local report when you use Navigation-> Go to report? -


we moving reporting services remote local,for i've been converting rdl files rdlc , changing reportviewers local processing , passing data source via code this:

  reportdatasource data = new reportdatasource("paragainsa", new inventariorptcs().selecciona_saldos_articulo(locid,             bodid,depid,famid,nbid,imid,desde,hasta));   reportviewer1.localreport.datasources.clear();   reportviewer1.localreport.datasources.add(data);   reportviewer1.localreport.refresh(); 

works great, i've encounter reports have subreports pass data source sub reports i've been doing this:

reportviewer1.localreport.subreportprocessing += new subreportprocessingeventhandler(subreportehandler);   private void subreportehandler(object sender, subreportprocessingeventargs e) {     int im_id =  convert.toint32(e.parameters[1].values[0].tostring());     int loc_id = convert.toint32(e.parameters[0].values[0]);     e.datasources.add(new reportdatasource("paragainsa", new inventariorptcs().selecciona_saldos_articulo_det(loc_id,im_id))); } 

it worked great, happily continue until find report has subreport , subreport has in 1 of fields: enter image description here

when click on field acts navigation link other report a data source instance has not been supplied data source 'datasource'.

so question is: there anyway can pass data source report inside sub report been call via navigation -> go report? if how?

i using vs 2013, sql server 2012

thank reading, pardon english not first languague

since not able find way solve did following try , simulate navigation between reports available(to knowledge) in processing mode remote,

first in rdlc file added 'ver mas informacion' in title property of column acting link other report , set color blue give link style

step

i had add tooltip(rendes title attribute) because not able find way able select specific cells wanted

then css style set cursor pointer

 [title="ver mas informacion"] {         cursor:pointer;     } 

then script using jquery handle click event geting values need parameter other report, navigate other report , pass parameter via url

 $(window).load(function () {         $(document).on('click', '[title="ver mas informacion"]', function () {             var locid = $('[id$="ddlocal"]').val();             var fecha = $(this).parent().parent()[0].childnodes[2].childnodes[0].innerhtml;             var tt_id = $(this).parent().parent()[0].childnodes[9].childnodes[0].innerhtml;             var ap_id = $(this).parent().parent()[0].childnodes[10].childnodes[0].innerhtml;             window.open(window.location.origin + config.base + '/reportes/rptsubviewer.aspx?sub=doc&loc=' + locid + '&fecha=' + fecha + '&ap=' + ap_id + '&tt_id=' + tt_id);         });      }); 

then on other webform added reportviewer , on code behind

  protected void page_load(object sender, eventargs e) {     if (!page.ispostback)     {         if (request.querystring["sub"] == "doc")         {             string _loc = request.querystring["loc"];             string _fecha = request.querystring["fecha"];             string _ap_id = request.querystring["ap"];             string _tt_id = request.querystring["tt_id"];             int loc_id = 0, tt_id = 0, ap_id = 0;             cultureinfo provider = new cultureinfo("en-us");             datetime fecha = datetime.now;             if (!string.isnullorempty(_loc))                 loc_id = convert.toint32(_loc);             if (!string.isnullorempty(_fecha))                 fecha = datetime.parseexact(_fecha,"dd/mmm/yyyy",provider);             if (!string.isnullorempty(_ap_id))                 ap_id = convert.toint32(_ap_id);             if (!string.isnullorempty(_tt_id))                 tt_id = convert.toint32(_tt_id);              if (tt_id == 14 || tt_id == 15 || tt_id == 21)             {                  list<reportparameter> paramlist = new list<reportparameter>();                 paramlist.add(new reportparameter("locid", _loc));                 paramlist.add(new reportparameter("fecha", fecha.toshortdatestring()));                 paramlist.add(new reportparameter("tt_id", _tt_id));                 paramlist.add(new reportparameter("tt_doc", _ap_id));                 reportdatasource data = new reportdatasource("araclds", new inventariorptcs().selecciona_saldos_articulo_doc(loc_id, fecha, tt_id, ap_id).tolist());                 rvsubnav.localreport.reportpath = "rdlcs\\reportekardexdoc.rdlc";                 rvsubnav.visible = true;                 rvsubnav.localreport.setparameters(paramlist);                 rvsubnav.localreport.datasources.clear();                 rvsubnav.localreport.datasources.add(data);                 rvsubnav.localreport.refresh();             }         }      } } 

not sure if best way got job done


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -