我很新的ASPX发展,我挣扎了很多与ASPX代码和aspx.cs连接,正是我下面的问题:C#/ aspx.net过程中提交值形成
DisplayChars.aspx:
<form id="form1" runat="server">
<div>
<div>Champion name: </div> <div><input id="Champ_name" type="text" /></div>
<div>Champion Icon URL: </div> <div><input id="Champ_icon" type="text" /></div>
<div>Champion Subtext: </div> <div><input id="Champ_subtext" type="text" /></div>
<div> Free to play :</div><div><input id="Champ_freetoplay" type="checkbox" />
</div>
<div>Positions:</div>
<div>
<input id="Top" type="checkbox" /> Top
<input id="Mid" type="checkbox" /> Mid
<input id="Jungle" type="checkbox" /> Jungle
<input id="Carry" type="checkbox" /> Carry
<input id="Support" type="checkbox" /> Support
</div>
</div>
<input id="Champ_Submit" type="submit" value="submit" />
DisplayChars.aspx.cs
if (IsPostBack)
{
//NameValueCollection nvc = Request.Form.GetValues
//Champion t1 = new Champion(Request.Form.Get("Champ_Name"), Int32.Parse(Request.Form.Get("Champ_freetoplay")), Request.Form.Get("Champ_subtext"), Request.Form.Get("Champ_description"), "10110");
//t1.persistChampion();
string temp = Request["Champ_name"];
所以我刚刚接到表值一些如何挣扎。 我试过Request.Form.GetValues
,Request.Form.Get
甚至Request["Form_id_Name"]
。
的问题是,如果这种做法是正确的,甚至,因为我已经在面向对象的编程经验,但不是在HTML ASPX伪服务器代码这个组合,和它背后的CS文件。
好的。我学到了新东西。 – Sami
非常感谢你,有点显而易见,因为我有一个隐藏的文本框已经这个属性! – user1808908