CreateElement in c#

mrjozo

Новичок
Регистрация
26.08.2015
Сообщения
5
Благодарностей
0
Баллы
1
Hi,

noticed that CreateElement is private and can't invoke it. Is it possible to create new html element in c# and put in to document? So far I've created html code in c# returned it to variable and then set it with zp block set innerhtml. But wondering if I can do this directly in c#?
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 707
Баллы
113
You can change innerhtml of element via C# (add whatever you want there)
 

mrjozo

Новичок
Регистрация
26.08.2015
Сообщения
5
Благодарностей
0
Баллы
1

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 771
Благодарностей
1 184
Баллы
113


C#:
// find element using "text" parameter
HtmlElement he = tab.MainDocument.FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
if (he.IsVoid) return -1;
// set innerhtml
he.SetAttribute("innerhtml", "New Innerhtml");
 

mrjozo

Новичок
Регистрация
26.08.2015
Сообщения
5
Благодарностей
0
Баллы
1
Thanks. I doesn't try SetAttribute for innerhtml because it's rather property not attribute due to w3 spec
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)