asp.net - How to reference a DataRow explicitly in the code behind and show/hide based on another DataRow value -
In a description view I have set View = Fault for TemplateField with "Header text for a treatment cause". You must use the Is it possible that in LINQ VB and without? Of course: & lt; Asp: Based on the value of the other TemplateField with the header of DetailsView ID, how can I explicitly reference the Detroit and make it based on other views? = "DvTest" FooterStyle-width = "100%" font-bold = "false" BackColor = "# A2C4EA" FieldHeaderStyle- width = "35%" BorderWidth = "1" cellspacing = "2" font-name = "Arial, Helvetica, sans-serif "font-size =" 12px "runat =" server "AutoGenerateRows =" false "AllowPaging =" false "style =" width: 98% "HeaderStyle-BackColor =" white "HeaderStyle- font-bold =" True "header style-horizontal alliance =" center "& gt; & Lt; Fields & gt; & Lt; Asp: TemplateField Header Text = "Care Plan Intent:" & gt; & Lt; ItemTemplate & gt; & Lt; ASP: Labels skinband = "tabblocks" id = "lbiitient" runat = "server" text = '& lt;% # Eval ("CarePlanIntent")% & gt; / & Gt; & Lt; Asp: HiddenField runat = "server" id = "hidCarePlanIntent" value = '& lt;% # Eval ("CarePlanIntent")% & gt; / & Gt; & Lt; / ItemTemplate & gt; & Lt; / ASP: TemplateField & gt; & Lt; Asp: TemplateField HeaderText = "There is no cure reason:" visible = "false" & gt; & Lt; ItemTemplate & gt; & Lt; ASP: Label SkinDance = "Tablailblack" ID = "LBL NETO Treatment Region" runat = "server" text = '& lt;% # Eval ("NoTreatmentReason")% & gt; / & Gt; & Lt; / ItemTemplate & gt; & Lt; / ASP: TemplateField & gt; & Lt; / Fields & gt; & Lt; / ASP: DetailsView & gt;
databound
event DataItem
) in order to follow the LINQ query < / Code> can use: FindControl
to get the right column to get your control and make it visible in (type DataRowView
secure void dvTest_DataBound (object sender, EventArgs E) {var noTreatCol = this.dvTest.Fields.Cast & lt; DataControlField & gt; (). First (field => field.HeaderText == "There is no cure reason:"); Detroit line = ((databarview) dvTest.DataItem) .ro; Label tableblocks = (label) dvTest.FindControl ("Tableblackbox"); HiddenField hidCarePlanIntent = (HiddenField) dvTest.FindControl ("hidCarePlanIntent"); String value = line.field & lt; String & gt; ("Values"); // Just an example noTreatCol.Visible = value == "SomeValueThatMakesItVisible"; }
SAFE sub dvTest_DataBound (as the object, such as e EventArgs) as dim row DataRow = DirectCast (dvTest. DataItem, DataRowView) .Row dim tablabelblack label = DirectCast (dvTest.FindControl ( "tablabelblack"), label) as dim hidCarePlanIntent as HiddenField = DirectCast (dvTest.FindControl ( "hidCarePlanIntent"), HiddenField) dim value string = row. ( "value as field (string)") is just one example "to = 0 Me.dvTest.Fields.Count as Int32 dim noTreatColIndex as Int32 = -1 i - 1 dim area = DvTest.Fields (i) y The field.HeaderText = "no healing" for then noTreatColIndex = I exit end next to noTreatColIndex & gt; -1 then dvTest.Fields (noTreatColIndex) .Visible = value = "SomeValueThatMakesIvVible" End If End Sub
Comments
Post a Comment