c# - Im trying to make a Repeater table visible = false -
I have a document management system that creates a report that contains people who have a document. There are times where people have 0 documents and in that case I want to see the repeater table for that person. I have looked around for a while and I do not have much luck, perhaps because of this I am new or perhaps because of that I got my answer.
I have repeaters within repeat iterations, but if the first defender should show the rest.
aspx file
& lt; H3 & gt; & Lt;% # DataBinder.Eval (container.detime, "FULNM")% & gt; & Lt; / H3 & gt; & Lt; Table id = "collectortable" run = "server" class = "report-yoga" & gt; & Lt; TR & gt; & Lt; Th & gt; Total aggregated: & lt; / Th & gt; & Lt; Td> & Lt; ASP: Liberal ID = "Collective Totalized" Runat = "Server" /> gt; & Lt; / Td> & Lt; Td square = "report-yoga-spacer" & gt; & Lt; / Td> & Lt; Th & gt; Total contact: & lt; / Th & gt; & Lt; Td> & Lt; ASP: Liberal ID = "collective total contact" runat = "server" /> gt; & Lt; / Td> & Lt; Td square = "report-yoga-spacer" & gt; & Lt; / Td> & Lt; Th & gt; & Lt; / Th & gt; & Lt; TD & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; / Table & gt; // etc ....
Behind the code
// ... Remove total control collector receptor = new control (); CollectorRepeater = (control) e. ITEM Fontcontrol ("collectorpeter"); CollectorRepeater.Visible = false; Repeat collector data = (Repeater) item FontControl ("Collected Table Repeater"); Collector data. Data source = archived documents; CollectorData.DataBind (); Repeater Contact Data = (Repeater) Items FindControl ("ContactTableRepeater"); contact data. Data source = contact document; ContactData.DataBind ();
So whatever you have to do, check that your data is empty or not Tie it up, or on a repeater's OnDataBinding event, and hide the repeaters if appropriate.
Repeat collector data = (Repeater) items. FontControl ("Collected Table Ripper 1"); Repeater Contact Data = (Repeater) item.FindControl ("ContactTableRepeater2"); If (collected documents. TBS [0] .Rows.Count> 0) {// If the data (more than 0 rows), then insert this collector data. Data.Source = collectedDocuments; CollectorData.DataBind (); contact data. Data source = contact document; ContactData.DataBind (); } Other {collector data Visible = false; // Optional display data contacted by the message "No data found". Visible = false; }
Comments
Post a Comment