c# - Read/edit values starting from a Telerik RadGrid -


i have situation:

a telerik radgrid

... normal radgrid data. and, if clic on row, want obtain this:

another telerik radgrid

... list of label-textbox pair (please pay attention: these list of data obtained row, not part of it).

with first radgrid it's okay. therefore, have used simple html table list of pair (in second image). list being generated code-behind, database.

the problem update of textboxs: if edit these textboxes , clic on update botton, starts myradgrid_updatecommand method. can't find way manage these textboxes (they don't appear in myradgrid.controls or else).

so have tried use radgrid inside first radgrid, no luck... maybe have use different telerik control?

someone know how can this?

this part of implementation:

    protected void myradgrid_needdatasource(object source, gridneeddatasourceeventargs e) {     this.myradgrid.datasource = this.dtlistadettagli;     this.dtlistadettagli.primarykey = new datacolumn[] { this.dtlistadettagli.columns["key"] }; }   protected void myradgrid_itemcreated(object sender, telerik.web.ui.griditemeventargs e) {     if (e.item grideditformitem && e.item.isineditmode)     {         grideditformitem item = (grideditformitem)e.item;         usercontrol usercontrol = (usercontrol)e.item.findcontrol(grideditformitem.editformusercontrolid);         var listofdetails = this.session["listofdetails"];         //...         var dtotrav = (list<detail_type_n>) listofdetails;         popolauc(dtotrav, usercontrol, e.item.itemindex);     } }   private void popolauc<t>(list<t> data, usercontrol uc, int index) t : flussibasedto {     // ...     radpane radpane = uc.findcontrol("radpane1") radpane;     var properties = typedescriptor.getproperties(typeof(detail_type_n));     // ...     var dettaglioselected = (from x in data                              x.idflusso == idflussoselected && x.progdettaglio == progdettaglioselected                              select x).firstordefault();      htmltable htmltable = new htmltable();     htmltable.id = "dettagliosinistro";     var trow = new htmltablerow();      int = 0;     foreach (propertydescriptor prop in properties)     {         i++;         if (i > 3) // organizza la sottotabella in 2 colonne         {             trow = new htmltablerow();             = 1;         }          // set label:         htmltablecell tlabel = new htmltablecell();         var stringinnormalcase = regex.replace(prop.name, "(\\b[a-z])", " $1");         tlabel.innertext = stringinnormalcase;         trow.cells.add(tlabel);          // set textbox:         htmltablecell tcell = new htmltablecell();         // ...         textbox box = new textbox();         box.text = convert.tostring(prop.getvalue(detailselected));         box.id = string.format("my_{0}", prop.name);         tcell.controls.add(box);           trow.cells.add(tcell);         htmltable.rows.add(trow);     }     radpane.controls.add(htmltable); }   protected void myradgrid_updatecommand(object source, gridcommandeventargs e) {     grideditableitem editeditem = e.item grideditableitem;     usercontrol usercontrol = (usercontrol)e.item.findcontrol(grideditformitem.editformusercontrolid);      //prepare new row add in datasource     datarow[] changedrows = this.dtlistadettagli.select("key = " + editeditem.ownertableview.datakeyvalues[editeditem.itemindex]["key"]);      // ... , then?      catch (exception ex)     {         changedrows[0].canceledit();          label lblerror = new label();         lblerror.text = string.format("errore nell'aggiornamento movimento. errore: {0} ", ex.message);         lblerror.forecolor = system.drawing.color.red;         radgridipa.controls.add(lblerror);          e.canceled = true;     } } 

you cannot generate textboxes , labels dynamically.

instead, want use edit form.

for example,

<telerik:radgrid id="radgrid1" ...>    <mastertableview>       ...       <editformsettings>           place textboxes , lables here.       </editformsettings>    </mastertableview> </telerik:radgrid> 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -