In my gridview rowdatabound event I have the following code
To improve its readablity in changed it toCode:if (e.Row.RowType == DataControlRowType.DataRow) { line_item item = e.Row.DataItem as line_item; if (!item.active) (e.Row.FindControl("linkName") as HyperLink).CssClass = "inactive"; (e.Row.FindControl("linkName") as HyperLink).NavigateUrl = "someUrl.aspx?id=" + item.id; //do some more stuff with linkName }
My question, should the created Hyperlink 'linkName' be disposed or not?Code:if (e.Row.RowType == DataControlRowType.DataRow) { line_item item = e.Row.DataItem as line_item; HyperLink linkName = (e.Row.FindControl("linkName") as HyperLink); if (!item.active) linkName.CssClass = "inactive"; linkName.NavigateUrl = "someUrl.aspx?id=" + item.id; //do some more stuff with linkName // linkName.Dispose(); ???? }




Reply With Quote