Repeater1 is normally bound outside, and repeater2 in it is directly bound to the method of returning the dataset in the HTML code to the datasource attribute.
Html
<Asp: repeater id = "repeater1" runat = "server" onitemdatabound = "repeaterincluitemdatabound">
<Headertemplate>
<Table width = "100%" border = "0" cellspacing = "0" cellpadding = "0">
</Headertemplate>
<Itemtemplate>
<Tr>
<TD align = "Left"> <Table width = "100%" border = "0" cellspacing = "0" cellpadding = "0">
<Tr>
<TD class = "brown02_14" style = "color: # ed9c72"> <% # databinder. eval (container. dataitem, "item_name") %> & nbsp; <a href = "linchuangyiyi. aspx? Testid = <% # eval ("testitem_id") %> "style =" color: # ff3399; font-weight: bold "><%# databinder. eval (container. dataitem, "lx") %> </a> </TD>
<TD align = "right" class = "brown02_14" style = "color: # ed9c72"> DOCTOR: <% # databinder. eval (container. dataitem, "check_opername") %> </TD>
</Tr>
</Table>
</TD>
</Tr>
<Table width = "100%" border = "0" cellpadding = "4" cellspacing = "0">
<Tr>
<TD align = "Left" bgcolor = "# e7effc" class = "brown02_14"> check the project name </TD>
<TD width = "50%" align = "Left" bgcolor = "# e7effc" class = "brown02_14"> result </TD>
<TD width = "5%" align = "Left" bgcolor = "# e7effc" class = "brown02_14"> Unit </TD>
<TD width = "13%" align = "right" bgcolor = "# e7effc" class = "brown02_14"> normal range value </TD>
</Tr>
<Tr>
<TD>
<Asp: repeater id = "rptdetails1" runat = "server" datasource = '<% # searchreportbyvidin (eval ("item_name"). tostring () %>'>
<Itemtemplate>
<Tr> <TD align = "Left" class = "brown02_12"> <% # databinder. eval (container. dataitem, "field_comment") %> & nbsp; <a href = "linchuangyiyi. aspx? Testid = <% # eval ("testitem_id") %> "style =" color: # ff3399; font-weight: bold "><%# databinder. eval (container. dataitem, "aid") %> </a> </TD>
<TD align = "Left" class = "black_12"> <% # databinder. eval (container. dataitem, "field_results "). tostring (). replace ("\ r \ n", "<br/>") %> </TD>
<TD align = "Left" class = "black_12"> <% # databinder. eval (container. dataitem, "DW") %> </TD>
<TD align = "right" class = "black_12"> <% # databinder. eval (container. dataitem, "FW") %> </TD>
<% -- <TD align = "Left" class = "black_12"> <% # databinder. eval (container. dataitem, "zcz_xx "). tostring () = databinder. eval (container. dataitem, "zcz_sx "). tostring ()? Databinder. eval (container. dataitem, "zcz_xx "). tostring (): ("Upper Limit:" + databinder. eval (container. dataitem, "zcz_sx "). tostring () + "<br/> lower limit:" + databinder. eval (container. dataitem, "zcz_xx "). tostring () %> </TD>
-- %> </Tr>
<Tr> <TD colspan = "4" Height = "0"> </TD> </tr>
</Itemtemplate>
</ASP: repeater>
</TD>
</Tr>
</Table>
</Itemtemplate>
<Footertemplate>
</Table>
</Footertemplate>
</ASP: repeater>
. CS
Public void searchreportbyvid ()
{
Datatable dt = manager. searchreportbyvid (VID + flag). Tables [0];
Datatable DTT = new datatable ("dttt ");
Datarow newrow = NULL;
If (Dt. Rows. Count! = 0)
{
Datacolumn Dc = new datacolumn ();
Dc = DTT. Columns. Add ("item_name", type. GetType ("system. String "));
Dc = DTT. Columns. Add ("check_opername", type. GetType ("system. String "));
Dc = DTT. Columns. Add ("testitem_id", type. GetType ("system. String "));
Dc = DTT. Columns. Add ("lx", type. GetType ("system. String "));
For (INT I = 0; I <DT. Rows. Count; I ++)
{
If (I <DT. Rows. Count-1)
{
If (Dt. Rows [I] ["item_name"]. tostring (). Trim ()! = DT. Rows [I + 1] ["item_name"]. tostring (). Trim ())
{
Newrow = DTT. newrow ();
Newrow ["item_name"] = DT. Rows [I] ["item_name"]. tostring ();
Newrow ["check_opername"] = DT. Rows [I] ["check_opername"]. tostring ();
Newrow ["testitem_id"] = DT. Rows [I] ["testitem_id"]. tostring ();
Newrow ["lx"] = DT. Rows [I] ["lx"]. tostring ();
DTT. Rows. Add (newrow );
}
}
Else {
Newrow = DTT. newrow ();
Newrow ["item_name"] = DT. Rows [I] ["item_name"]. tostring ();
Newrow ["check_opername"] = DT. Rows [I] ["check_opername"]. tostring ();
Newrow ["testitem_id"] = DT. Rows [I] ["testitem_id"]. tostring ();
Newrow ["lx"] = DT. Rows [I] ["lx"]. tostring ();
DTT. Rows. Add (newrow );
}
}
}
Repeater1.datasource = DTT;
Repeater1.databind ();
}
Public datatable searchreportbyvidin (string item_name)
{
Datatable tbldatas = new datatable ("DTT ");
Datatable dt = manager. searchreportbyvid (VID + flag). Tables [0];
If (Dt. Rows. Count! = 0)
{
Datacolumn Dc = new datacolumn ();
Dc = tbldatas. Columns. Add ("field_comment", type. GetType ("system. String "));
Dc = tbldatas. Columns. Add ("field_results", type. GetType ("system. String "));
Dc = tbldatas. Columns. Add ("DW", type. GetType ("system. String "));
// Dc = tbldatas. Columns. Add ("zcz_xx", type. GetType ("system. String "));
// Dc = tbldatas. Columns. Add ("zcz_sx", type. GetType ("system. String "));
Dc = tbldatas. Columns. Add ("testitem_id", type. GetType ("system. String "));
Dc = tbldatas. Columns. Add ("aid", type. GetType ("system. String "));
Dc = tbldatas. Columns. Add ("FW", type. GetType ("system. String "));
For (INT I = 0; I <DT. Rows. Count; I ++)
{
If (Dt. Rows [I] ["item_name"]. tostring (). Trim () = item_name)
{
Datarow newrow = tbldatas. newrow ();
Newrow ["field_comment"] = DT. Rows [I] ["field_comment"]. tostring ();
Newrow ["field_results"] = DT. Rows [I] ["field_results"]. tostring ();
Newrow ["DW"] = DT. Rows [I] ["DW"]. tostring ();
// Newrow ["zcz_xx"] = DT. Rows [I] ["zcz_xx"]. tostring ();
// Newrow ["zcz_sx"] = DT. Rows [I] ["zcz_sx"]. tostring ();
Newrow ["testitem_id"] = DT. Rows [I] ["testitem_id"]. tostring ();
Newrow ["aid"] = DT. Rows [I] ["aid"]. tostring ();
Newrow ["FW"] = DT. Rows [I] ["FW"]. tostring ();
Tbldatas. Rows. Add (newrow );
}
}
}
Return tbldatas;
}