2006/Jul/14

เป็นเรื่องแปลกอีกเรื่องหนึ่งครับว่า ใน asp.net controls textbox textmode=passwordหรือ input type เป็น password และต้อง runat=server ด้วย ไม่สามารถที่จะกำหนดค่าเริ่มต้นหรือค่า default ได้เช่น โดยปกติเราสามารถกำหนดค่านี้ได้โดยวิธีง่ายๆ
<input type="password" value="1234" name="passwordStr" >
แต่ในasp.netไม่สามารถทำได้
<input type="password" value="1234" name="passwordStr" runat="server" >
หรือ
<asp:textbox id="passwordStr" runat="server"text="1234" textmode="password" />
วิธีแก้ก็คือใช้เพิ่มattributevalue เข้าไป
passwordStr.Attribute.add("value","1234");

ชื่อ: 
เว็บไซต์: 
คอมเมนต์:




smilebig smileopen-mounthed smileconfused smilesad smileangry smiletonguequestionembarrassedsurprised smilewinkdouble winkcry

<< Home