Jump to content
Software FX Community

some questions


julio15
 Share

Recommended Posts

 Hello,

  •  How can I dynamically in C# create an expandable grid (detail table)
    from Grid1 (master table)? Are these two grids related through the
    primary key?
2.   How can I change the message: No data in Grid?.

  3. When I do a copy of the data contained in Grid1, and I want to see the next page I encounter the following difficulty:

 - The operation takes forever to materialize and the message : "it is taking a long to process your request..." comes on the screen.

How  can I avoid such a problem?

 
Thanks,

 
julio
 
 

Link to comment
Share on other sites

 

  1. Expandable areas like Sidebars, are based on templates though when you set an Expandable area at design time, Grid FX is automatically implementing an ASP.NET ITemplate Interface. Therefore, to create an Expandable area programmatically you'll have to write the code to implement an ASP.NET ITemplate Interface first. Shortly we

Link to comment
Share on other sites

Hi! First
of all, thank you for your answers.




In the
cases of creating dynamically the Grids, both the master table and the detail
table, up to a second level, already function properly.




At present,
I am using IIS and two tables (master table and detail table) to carry out a
test. Statically, I create Grid 1 with an empty field(NombreProvincia) otherwise I could not
create Grid 2 as a daughter table. I do all the remaining work
dynamically.  Given below is the code
showing the way I configure the Grids:
















protected void Grid1_Load(object sender, EventArgs
e)


  {


  if (!IsPostBack)


  {


 
Session["Llamada"] = "Nulo";


  String d = Grid1.DataSourceID;


 
Grid1.DataSourceID = "";








  NumberField field2 = new
NumberField();


  NumberField field3 = new
NumberField();


  FieldColumn col2 = new
FieldColumn();


  FieldColumn col3 = new
FieldColumn();










 
field2.DataPath = "IndiceRango";


 
col2.Field = field2;


 
field3.DataPath = "IndiceNacional";


 
col3.Field = field3;














 
Grid1.Fields.Add(field2);


 
Grid1.Fields.Add(field3);


 
Grid1.Columns.Add(col2);


 
Grid1.Columns.Add(col3);


 
Grid1.DataBind();






  Grid1.Fields[0].Title
= "Provincia";


 
Grid1.Fields[1].Title = "Indice
rango";


 
Grid1.Fields[2].Title = "Indice
nacional";














  ((FieldColumn)Grid1.Columns[0]).Style.Bold = true; // para una sola
columna


  Grid1.ItemSettings.Style.HorizontalAlign = HorizontalAlign.Center;//
para todos los items


 
Grid1.SideBars[0].Side = SideBarSide.Bottom; 


  } 


  }


































  protected void
Grid1_DataBinding(object sender, EventArgs e)


  {


  TCtrInterrupciones
interrupciones = new TCtrInterrupciones();


  if
(Session["Llamada"].ToString() == "Nulo")


  {


DateTime Fecha1 = new
DateTime();


DateTime Fecha2 = new
DateTime();


  Fecha1 = Convert.ToDateTime("20/02/06");


  Fecha2 = Convert.ToDateTime("22/06/06");


  DataSet
DSInt = interrupciones.ReporteIndiceLineasNV("Nacional",
Fecha1, Fecha2, "Circuitos Primarios");


  DataView DV = new DataView();


  DV =
DSInt.Tables[0].DefaultView;


  Grid1.DataSource
= DV;


  }


  Session["Llamada"]
= "Nulo";


  }


















  protected void
Grid1_PageIndexChanging(object sender, GridPageEventArgs args)


  {


  String sd = args.ToString();


  int t = args.NewPageIndex;


Grid1.DataBind();


  Session["Llamada"] = "ok";


  }






  protected void Grid2_Load(object sender, EventArgs
e)


  {


  try








  {


  int pos = DevolverPosItemExp();






  if (Session["Expandido"].ToString()
!= "True")


  {


  Grid Grid2 = (Grid)Grid1.Items[pos].DetailsCell.FindControl("Grid2");


  ConfigurarGrid2(Grid2);


Session["Llamada"] = "Nulo";


















  Session["Llamada"] = "BindingGrid2Exp";


Grid2.DataBind();


  Grid2.ItemSettings.Style.HorizontalAlign = HorizontalAlign.Center;//
para todos los items


 
Session["Expandido"] = "True";


  }


  else








  {
Session["Expandido"] = "False"; }


  }


  catch { Session["Expandido"]
= "False"; }


  }








  protected void Grid2_DataBinding(object sender, EventArgs
e)


  {


  try








  {


  String prueba = Session["PrimeraLlamadaGrid2"].ToString();


    }


  catch








  {


 
Session["Expandido"] = "False";


  Session["PrimeraLlamadaGrid2"] = "True";


  }


  TCtrInterrupciones
interrupciones = new TCtrInterrupciones();




































  if (Session["Llamada"].ToString()
== "BindingGrid2Exp")


  {


  int pos = DevolverPosItemExp();


  Grid Grid2 = (Grid)Grid1.Items[pos].DetailsCell.FindControl("Grid2");


  String Prov = Grid1.Items[pos].DataValues["NombreProvincia"].ToString();


  Grid2.DataSourceID
= "";


  DateTime Fecha1 = new
DateTime();


  DateTime Fecha2 = new
DateTime();


 
Fecha1 = Convert.ToDateTime("20/02/06");


  Fecha2 = Convert.ToDateTime("22/06/06");


  DataSet
DSInt = interrupciones.ReporteIndiceLineasNV(Prov, Fecha1, Fecha2, "Circuitos Primarios");


  DataView DV = new DataView();


  DV =
DSInt.Tables[1].DefaultView;


  Grid2.DataSource
= DV;


  }


  Session["Llamada"]
= "Nulo";


  }






















  private void
ConfigurarGrid2(Grid Grid2)


  {


  Grid2.LayoutType
= GridLayoutType.Columnar;


  Grid2.Motif
= GridMotif.Default;


  Grid2.Palette
= GridPalette.Windows;


  Grid2.EnableFloatingBar
= false;


  Grid2.Selection.Enabled
= true;


  Grid2.Highlighting.Enabled
= false;


  Grid2.Paging.PageSize
= 10;


  Grid2.DataSourceID
= "";














  TextField field2 = new
TextField();


  NumberField field3 = new
NumberField();


  NumberField field4 = new
NumberField();


  NumberField field5 = new
NumberField();


  NumberField field6 = new
NumberField();


  NumberField field7 = new
NumberField();


  NumberField field8 = new
NumberField();














  FieldColumn col2 = new
FieldColumn();


  FieldColumn col3 = new
FieldColumn();


  FieldColumn col4 = new
FieldColumn();


  FieldColumn col5 = new
FieldColumn();


  FieldColumn col6 = new
FieldColumn();


  FieldColumn col7 = new
FieldColumn();


  FieldColumn col8 = new
FieldColumn();






























 
field2.DataPath = "FechaMes";


 
col2.Field = field2;


 
field3.DataPath = "IndAnnoAntMes";


 
col3.Field = field3;


  field4.DataPath
= "PlanMes";


 
col4.Field = field4;


 
field5.DataPath = "Indice";


  col5.Field
= field5;


 
field6.DataPath = "IndAnnoAntAcum";


 
col6.Field = field6;


 
field7.DataPath = "PlanAcum";


 
col7.Field = field7;


 
field8.DataPath = "IndAcumulado";


 
col8.Field = field8;


















  Grid2.Fields.Add(field2);


  Grid2.Fields.Add(field3);


  Grid2.Fields.Add(field4);


  Grid2.Fields.Add(field5);


  Grid2.Fields.Add(field6);


  Grid2.Fields.Add(field7);


Grid2.Fields.Add(field8);














  Grid2.Columns.Add(col2);


  Grid2.Columns.Add(col3);


  Grid2.Columns.Add(col4);


  Grid2.Columns.Add(col5);


  Grid2.Columns.Add(col6);


  Grid2.Columns.Add(col7);


  Grid2.Columns.Add(col8);


  Session["PrimeraLlamadaGrid2"] = "False";


  }




































  private int
DevolverPosItemExp()


  {


  int j = 0;


  foreach (GridItem
currItem in Grid1.Items)


  {


  if (currItem.Expanded)


  {


  return j;


  }


  j++;


  }


  j = -1;


  return j;


 
}



I have
other 2 questions:
 




  1. What can I do to prevent the message
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...