C# WEB开发中,类中如何操作 另一个页面中的WEB控件
答案:6 悬赏:10 手机版
解决时间 2021-11-12 21:34
- 提问者网友:戎马万世
- 2021-11-12 04:38
C# WEB开发中,类中如何操作 另一个页面中的WEB控件
最佳答案
- 五星知识达人网友:渡鹤影
- 2021-11-12 06:16
public static void cxobj( TextBox txt)
{
txt.text ="成功";
}参考资料:自己
{
txt.text ="成功";
}参考资料:自己
全部回答
- 1楼网友:野味小生
- 2021-11-12 10:37
占个位置
- 2楼网友:封刀令
- 2021-11-12 09:51
Hdoc.InternetExplorer ie = null;
System.Diagnostics.Process p = Process.Start("iexplore.exe","http://localhost/webProject/default.aspx");
Hdoc.ShellWindows allBrowsers = new SHDocVw.ShellWindowsClass();
Hdoc.InternetExplorer iet;
for(int i = 0; i < allBrowsers.Count; i ++)
{
iet = (Hdoc.InternetExplorer)allBrowsers.Item(i);
int debugVal = (int)p.MainWindowHandle;
int debug2Val = iet.HWND;
if(iet.HWND == (int)p.MainWindowHandle)
{
ie = iet;
break;
}
}
if(ie == null)
{
return;
}
Html.HTMLDocument theDoc = (Html.HTMLDocument)ie.Document;
HtmlDocumentOperation(theDoc);
private void HtmlDocumentOperation(Html.HTMLDocument theDoc)
{
Html.HTMLInputElement textBox = (Html.HTMLInputElement)theDoc.getElementById("Account");
textBox.value = "Account";
textBox = (Html.HTMLInputElement)theDoc.getElementById("DisplayName");
textBox.value = "SoloLive";
textBox = (Html.HTMLInputElement)theDoc.getElementById("Password");
textBox.value = "password";
textBox = (Html.HTMLInputElement)theDoc.getElementById("ConfirmPassword");
textBox.value = "password";
Html.HTMLAnchorElement anchor = (Html.HTMLAnchorElement)theDoc.getElementById("Linkbutton1");
anchor.href = "AboutMe.aspx";
anchor.click();
}
是不是想要这种处理方式?需要添加Microsoft.mshtml
SHDocVw
两个组件.
System.Diagnostics.Process p = Process.Start("iexplore.exe","http://localhost/webProject/default.aspx");
Hdoc.ShellWindows allBrowsers = new SHDocVw.ShellWindowsClass();
Hdoc.InternetExplorer iet;
for(int i = 0; i < allBrowsers.Count; i ++)
{
iet = (Hdoc.InternetExplorer)allBrowsers.Item(i);
int debugVal = (int)p.MainWindowHandle;
int debug2Val = iet.HWND;
if(iet.HWND == (int)p.MainWindowHandle)
{
ie = iet;
break;
}
}
if(ie == null)
{
return;
}
Html.HTMLDocument theDoc = (Html.HTMLDocument)ie.Document;
HtmlDocumentOperation(theDoc);
private void HtmlDocumentOperation(Html.HTMLDocument theDoc)
{
Html.HTMLInputElement textBox = (Html.HTMLInputElement)theDoc.getElementById("Account");
textBox.value = "Account";
textBox = (Html.HTMLInputElement)theDoc.getElementById("DisplayName");
textBox.value = "SoloLive";
textBox = (Html.HTMLInputElement)theDoc.getElementById("Password");
textBox.value = "password";
textBox = (Html.HTMLInputElement)theDoc.getElementById("ConfirmPassword");
textBox.value = "password";
Html.HTMLAnchorElement anchor = (Html.HTMLAnchorElement)theDoc.getElementById("Linkbutton1");
anchor.href = "AboutMe.aspx";
anchor.click();
}
是不是想要这种处理方式?需要添加Microsoft.mshtml
SHDocVw
两个组件.
- 3楼网友:深街酒徒
- 2021-11-12 08:48
想直接操作,要把seve.aspx上的textbox的modifiers属性设为public。
建议设一个变量,传值,在seve.aspx页面接受。
建议设一个变量,传值,在seve.aspx页面接受。
- 4楼网友:神鬼未生
- 2021-11-12 07:21
设一个静态变量,将控件付给这个变量,然后又静态函数调用
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯