c# - Making a Detailview Field Invisible and Acessible -
i had databound detailsviewcontrol . displaying questions , answer option , correct answer
<asp:detailsview id="detailsview1" runat="server" autogeneraterows="false" backcolor="white" bordercolor="#999999" borderstyle="solid" borderwidth="1px" cellpadding="3" datasourceid="sqldatasource1" gridlines="vertical" height="50px" width="477px" forecolor="black"> <alternatingrowstyle backcolor="#cccccc" /> <editrowstyle backcolor="#000099" font-bold="true" forecolor="white" /> <fields> <asp:boundfield datafield="question" headertext="question" sortexpression="question" /> <asp:boundfield datafield="answer 1" headertext="answer 1" sortexpression="answer 1" /> <asp:boundfield datafield="answer 2" headertext="answer 2" sortexpression="answer 2" /> <asp:boundfield datafield="answer 3" headertext="answer 3" sortexpression="answer 3" /> <asp:boundfield datafield="answer 4" headertext="answer 4" sortexpression="answer 4" /> <asp:boundfield datafield="correct answer" headertext="correct" sortexpression="correct answer" > <footerstyle bordercolor="white" /> </asp:boundfield> <asp:boundfield datafield="id" sortexpression="id" /> </fields> <footerstyle backcolor="#cccccc" /> <headerstyle backcolor="black" font-bold="true" forecolor="white" /> <pagerstyle backcolor="#999999" forecolor="black" horizontalalign="center" /> </asp:detailsview>
but want hide correct answer field user tried make correctanswer feild invisible designer , succeed issue when try read value of invisible feild
a.correctanswer = detailsview1.rows[5].cells[1].text;
i getting empty string value invisible details view field
can suggest way of making field invisible keeping value accessible code behind
set cssclass
invisible
cssclass="invisible"
and create ivisible css class:
.invisible { display:none; }
Comments
Post a Comment