关于'隐藏'表单控件的问题 [英] Question about 'hiding' form controls

查看:40
本文介绍了关于'隐藏'表单控件的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我自己陷入了一个问题,我正在努力挖掘回来

out ,a)由于项目截止日期最快的方式,以及b)最好的

方法。


我有一个获取一组文档类型属性的表单从SQL Server,

这些属性用于在表单上创建相应的控件,所以

例如:


PropertyDisplayName:姓氏

PropertyObjectName:txtSurname


在这个非常小的例子中,Surname文本将显示在文本框的左侧

,其ID为txtSurname。


目前有6种不同的文档类型 - 每个属性都有一组

属性,每个文档类型中都有一些属性(例如

姓)。


我的问题是如果我的查询字符串不包含''文档类型''我

不知道给用户提供什么类型的表单 - 因此表单有一个下降

向下菜单,其中列出了所有列出的文档类型供选择 -

仅当查询字符串值丢失时才显示,如果存在,则返回
然后下拉菜单替换为一个只读文本框,其中包含

文档类型的名称。


我需要做的是查询字符串不包含

的值,文档类型将更改表单上的控件。这需要

无需重新加载页面即可实现。


最初我认为我可以获得所有文档类型和

一开始就从数据库中关联属性,将每个

文档类型放入一个单独的面板中,然后显示/隐藏相关的

面板 - 我唯一的问题(未经测试)是我对每个动态创建的控件都有验证

控件 - 这些控件的名称也是从数据库中获取的
- 即txtSurname会有前3个字符

掉落然后添加vld - 创建vldSurname,我可以预见我是否会沿着这条路线转移
6个面板至少共享1控制是相同的

(比方说姓氏) - 因此有6个txtSuranmes和6个vldSurnames -

肯定这会导致某种形式的问题,因为名字不会是独一无二。


我的下一个想法可能是创造o ne显示所有

属性,无论它们属于哪种文档类型,并设置

将它们全部设置为在开始时可见= false - 然后如果需要它们通过

文档类型将其可见状态更改为true。我的问题是

是否将控件设置为visible = false是否在提交表单时仍然提交了



任何关于此的信息或建议都将受到赞赏 - 如果我有更多的

时间,我可以回去改变一些可能会删除这个

问题的东西 - 但是时间已经快结束了所以我现在需要''最好的解决方案'

有点接近。


问候

Rob

Hi all,

I''ve got myself into a bit of a problem and I''m trying to dig my way back
out, in a) the quickest way due to project deadline and also b) best
approach.

I have a form which gets a set of document type properties from SQL Server,
these properties are used to create corresponding controls on the form, so
for example:

PropertyDisplayName : Surname
PropertyObjectName : txtSurname

In this very small example the "Surname" text would be displayed on the left
of the text box which would have the ID of "txtSurname".

There are currently 6 different document types - each with a set of
properties, some of the properties are common in each document type (like
surname for example).

My problem is that if my querystring does not contain the ''document type'' I
dont know what type of form to give the user - therefore the form has a drop
down menu with all of the document types listed for them to select from -
this only appears if the querystring value is missing, if it is present,
then the drop down is replaced with a readonly text box with the name of the
document type in it.

What I need to do in the case of the querystring not containing a value for
the document type would be to change the controls on the form. This needs
to be achieve without a reload of the page.

Initially I was thinking that I could get all of the document types and
associated properties from the database in one go at the beginning, put each
document type into a seperate ''panel'' and then show/hide the relevant
panel - my only probelm with this (untested) is that I also have validation
controls for each dynamically created control - the names for these are also
taken from the database - ie txtSurname would have the first 3 characters
dropped and then have vld added - creating vldSurname, I can foresee if I go
down this route 6 panels all sharing at least 1 control which is the same
(lets say surname) - and therefore having 6 txtSuranmes and 6 vldSurnames -
surely this will cause some form of problem as the names wont be unique.

My next thought was perhaps to create the one display with all of the
properties on it regardless of which document type they belong to and set
them all to visible = false at the start - then if they are needed by the
document type change their visible status to true. My question here is
whether or not if you set a control to visible = false whether it still gets
submitted when the form is submitted?

Any information or suggestions on this would be appreciated - if I had more
time for this I may go back and change somethings which may remove this
issue - however time has nearly run out so I need a ''best solution for now''
kinda approach.

Regards

Rob

推荐答案

" Rob Meade" < RO ********** @ NOSPAMubht.swest.nhs.uk>在消息中写道

新闻:OC ************* @ TK2MSFTNGP12.phx.gbl ...
"Rob Meade" <ro**********@NOSPAMubht.swest.nhs.uk> wrote in message
news:OC*************@TK2MSFTNGP12.phx.gbl...
任何信息或者对此的建议将不胜感激 - 如果我有更多的时间用于此,我可以回去改变一些可能会消除这个问题的事情 - 但是时间已经快结束所以我需要''最佳解决方案
现在''有点接近。
Any information or suggestions on this would be appreciated - if I had more time for this I may go back and change somethings which may remove this
issue - however time has nearly run out so I need a ''best solution for now'' kinda approach.




这些天不太时髦,但你可能能够实现你的目标

想要一个FRAMESET。



Not very fashionable these days, but you might be able to achieve what you
want with a FRAMESET.


" Mark Rae"写道......


嗨马克 - 谢谢你的回复。
"Mark Rae" wrote ...

Hi Mark - thanks for your reply.
这些天不太流行,


你的意思是''接近''?

但是你可以用FRAMESET达到你想要的效果。
Not very fashionable these days,
you mean the ''approach''?
but you might be able to achieve what you want with a FRAMESET.




就像在HTML框架中一样......如果我开始在我的应用程序中使用框架

,我就永远不会失望....


control.visible = false不是简单地从

渲染页面中删除控件吗?


问候


Rob



as in the HTML frameset...I''d never live it down if I started using frames
within my applications....

Would the control.visible = false not simply remove the control from the
rendered page?

Regards

Rob


嗨马克,我只是重新阅读你会回复的内容 - 比如我......我看到了你的内容

是现在说 - 也就是说,Framesets不是太时髦......


大笑......需要更多的睡眠! :)


Rob
Hi Mark, I just re-read what you''d reply with - like duh me...I see what you
are saying now - ie, Framesets are not overly fashionable....

lol...need more sleep! :)

Rob


这篇关于关于'隐藏'表单控件的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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