表格字段类型 [英] Form Field Type

查看:63
本文介绍了表格字段类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Friends


我在aspx中编写了一个简单的HTML页面

我添加了表单元素,如textBox,隐藏字段等。 ,图像,单选按钮,到html表格


我将数据发回到同一页面

有没有办法知道类型?回帖后的表格元素在页面的代码隐藏文件中有意义,是否有办法找到类型所有表单元素(textBox,隐藏字段,图像,单选按钮等等


任何指导将不胜感激


非常感谢

Mohit

Hello Friends

I have written a simple HTML page in aspx
I have added form elements like "textBox", "Hidden fields", "images", "radio buttons" to the html form

I am posting the data back to the same page
Is there a way to know the "Type" of a form element upon post back. Meaning in the code behind file of the page, is there a way to find the "Type" all the form elements ("textBox", "Hidden fields", "images", "radio buttons" etc

Any guidance will be greatly appreciated

Many Thanks
Mohit

推荐答案

我不太清楚你是什么重新尝试 - 你是否希望能够找到

类型,因为你打算有一些页面,你不知道
知道控件提前?


将出现使用

属性runat = server设置的所有控件(表单元素)在页面的控件集合中(

类型ControlCollection)。你可以遍历这个集合并在每个控件上使用

GetType()来为你提供类型控件(它给你

a类型对象,但你可以使用ToString()来获得一个带有

类型名称的字符串)。这只是一个使用上面

属性设置的那些 - 你添加的任何你不添加的HTML控件

这个属性不会出现控制系列。


这有帮助吗? - 这是你想要做的事情吗?


Pete Beech

" Mohit Gupta" < MB ******* @ yahoo.com>在消息中写道

新闻:E1 ********************************** @ microsof t.com ...
I''m not quite sure what you''re trying to do - do you want to be able to find
out the types because you are planning to have some page for which you don''t
know the controls in advance?

All controls ("form elements" as you call them) which are set with the
attribute "runat=server" will appear in the Page''s Controls collection (of
type ControlCollection). You can loop through this collection and use
GetType() on each control to give you the type of the control (it gives you
a Type object, but you can use ToString() on this to get a string with the
name of the type). This only applies to those which you have set with the
attribute above - any HTML controls which you add for which you don''t add
this attribute won''t be in the Controls collection.

Does that help at all? -is that the kind of thing you want to do?

Pete Beech
"Mohit Gupta" <mb*******@yahoo.com> wrote in message
news:E1**********************************@microsof t.com...
Hello Friends,

我在aspx中编写了一个简单的HTML页面。
我添加了像textBox这样的表单元素, 隐藏字段,图像,
单选按钮"到html表单。
我将数据发布回同一页面。
有没有办法知道类型?回帖后的表格元素
在页面的代码隐藏文件中的含义,有没有办法找到

" Type"所有表单元素(textBox,隐藏字段,图像,收音机

按钮等)
任何指导将不胜感激。

非常感谢,
Mohit
Hello Friends,

I have written a simple HTML page in aspx.
I have added form elements like "textBox", "Hidden fields", "images", "radio buttons" to the html form.
I am posting the data back to the same page.
Is there a way to know the "Type" of a form element upon post back. Meaning in the code behind file of the page, is there a way to find the
"Type" all the form elements ("textBox", "Hidden fields", "images", "radio
buttons" etc)
Any guidance will be greatly appreciated.

Many Thanks,
Mohit



我不太确定你在做什么 - 你呢希望能够找到

的类型,因为你打算有一些页面你不需要b $ b提前知道控件吗?


使用

属性runat = server设置的所有控件(表单元素)将出现在Page's Controls集合中(

类型ControlCollection)。你可以遍历这个集合并在每个控件上使用

GetType()给你控件的类型(它给你

a类型对象,但你可以使用ToString ()对此获取一个带有

类型名称的字符串)。这仅适用于您使用上面的

属性设置的那些 - 您添加的任何HTML控件,您不能添加

此属性不会在Controls系列中。


这有帮助吗? - 这是你想要做的事情吗?


Pete Beech

" Mohit Gupta" < MB ******* @ yahoo.com>在消息中写道

新闻:E1 ********************************** @ microsof t.com ...
I''m not quite sure what you''re trying to do - do you want to be able to find
out the types because you are planning to have some page for which you don''t
know the controls in advance?

All controls ("form elements" as you call them) which are set with the
attribute "runat=server" will appear in the Page''s Controls collection (of
type ControlCollection). You can loop through this collection and use
GetType() on each control to give you the type of the control (it gives you
a Type object, but you can use ToString() on this to get a string with the
name of the type). This only applies to those which you have set with the
attribute above - any HTML controls which you add for which you don''t add
this attribute won''t be in the Controls collection.

Does that help at all? -is that the kind of thing you want to do?

Pete Beech
"Mohit Gupta" <mb*******@yahoo.com> wrote in message
news:E1**********************************@microsof t.com...
Hello Friends,

我在aspx中编写了一个简单的HTML页面。
我添加了像textBox这样的表单元素, 隐藏字段,图像,
单选按钮"到html表单。
我将数据发布回同一页面。
有没有办法知道类型?回帖后的表格元素
在页面的代码隐藏文件中的含义,有没有办法找到

" Type"所有表单元素(textBox,隐藏字段,图像,收音机

按钮等)
任何指导将不胜感激。

非常感谢,
Mohit
Hello Friends,

I have written a simple HTML page in aspx.
I have added form elements like "textBox", "Hidden fields", "images", "radio buttons" to the html form.
I am posting the data back to the same page.
Is there a way to know the "Type" of a form element upon post back. Meaning in the code behind file of the page, is there a way to find the
"Type" all the form elements ("textBox", "Hidden fields", "images", "radio
buttons" etc)
Any guidance will be greatly appreciated.

Many Thanks,
Mohit



感谢您的回复Pete


其实这不是我要找的东西

控件不是服务器端控件,它们是纯HTML 4.0控件。所以我不能使用controlCollection

有没有办法获得HTML 4.0元素的类型(< input type = hidden name = mycontrol> ...)?


谢谢


Mohit
Thanks for your reply Pete

Actually this is not what i am looking for
The controls are not server side controls, they are plain HTML 4.0 controls. So i cannot use the controlCollection
Is there a way to get the type of HTML 4.0 elements (<input type=hidden name=mycontrol> ...)?

Thank You

Mohit


这篇关于表格字段类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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