在c#中获取html标记 [英] get html tag in c#

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

问题描述

我有CreateUserWizard并使用任何asp控件。

如asp:textbox和...

我找到我的自定义控件以下命令:



i have CreateUserWizard and use any asp control into this.
such as asp:textbox and...
and i find my custom control for below command:

TextBox MobileTxt = CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("MobileTxt") as TextBox;





现在我在CreateUserWizard中使用此标签:





and now i use this tag in CreateUserWizard:

<select size="1" name="city" id="city_id" runat="server">
    <option selected="selected" value="">please select your city</option>
</select>





我怎么能找到我的< select>标记并在c#中获取所选值?



我不想使用asp:drowpdownlist



how i can find my <select> tag and get selected value in c#?

and i don't want use asp:drowpdownlist

推荐答案





试试这个:

Hi,

Try this:
string selectedOptionValue = city_id.Items[city_id.SelectedIndex].Value;
string selectedOptionText = city_id.Items[city_id.SelectedIndex].Text;



希望这会有所帮助。


Hope this helps.


var control= Request.Form["someId"];





更多细节请参考以下链接:

http://stackoverflow.com/questions/4351361/accessing-client-side-dynamic-controls -within-asp-net-codebehind [ ^ ]


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

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