Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Hi, I want to remove parent controls without deleting its children controls from container. how can I accomplish this in asp.net c#?
- public static Control FindChildControl(Control startingControl, string id)
- {
- Control found = null;
- foreach (Control activeControl in startingControl.Controls)
- {
- found = (Control)activeControl;
- if (found == null || (string.Compare(id, found.ID, true) != 0))
- {
- if (object.ReferenceEquals(found.GetType(), typeof(HtmlGenericControl))
- && ((HtmlGenericControl)found).Attributes["class"] == "result-listingext"
- && ((HtmlGenericControl)found).Attributes["id"] == "newsright")
- {
- return found.Parent;
- }
- found = FindChildControl(activeControl, id);
- }
- if (found != null)
- {
- break;
- }
- }
- return found;
- }
- //below is the output which is being generated, and I want to remove this span from dynamically generated html code
- <span><ul id="abc" class="result-listingext" id="newsright"><li>Hello 1</li><li>Hello 1</li></ul></span>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement