在C#页面中获取html控件ID [英] get html control Id in C# page

查看:678
本文介绍了在C#页面中获取html控件ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hii all
我在html页面中输入了类型文件,
我想获取此ID并应用在其上上传图片的代码.
但是,不幸的是代码看不到控件

hii all
i have an input of the type file in html page ,
i want to get this Id and apply the code of upload an image on it.
but, Unfortunately the code doesn''t see the control

Control myControl1 = FindControl("FileUpload1");
if (myControl1 != null)
{
}
else
{
    Response.Write("Control not found");
}







<input type="file" name="FileUpload1" id="FileUpload1" value="FileUpload1" />



任何帮助

感谢



any help

thanks

推荐答案

将runat ="server"添加到Input标签,您可以从代码隐藏中访问FileUpload1
add runat="server" to Input tag and you can access the FileUpload1 from codebehind


这篇关于在C#页面中获取html控件ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆