When you use detailsview to edit a value, you can get the value on the page when adding the mode. When you are in edit mode, you cannot get the value.
String M_strsum = Sof. Common. gatewayfactory. getdefault (). fromcustomsql ( " Select count (*) as exercisesum from d_job_arithmeticexercise " ). Todataset (). Tables [ 0 ]. Rows [ 0 ] [ " Exercisesum " ]. Tostring ();
String M_strnormal = Gateway. Count < Arithmeticexercise > (Arithmeticexercise. _. fsort = " 0 " ). Tostring ();
String M_strartifice = Gateway. Count < Arithmeticexercise > (Arithmeticexercise. _. fsort = " 1 " ). Tostring ();
Dvarithmeticexampaper. defaultmode = String . Isnullorempty (fguid) = True ? Detailsviewmode. insert: detailsviewmode. Edit;
This . Title = (Dvarithmeticexampaper. defaultmode = Detailsviewmode. Edit) ? " Modify arithmetic questions " : " Add arithmetic questions " ;
Labelsum. Text = M_strsum;
Labelnormal. Text = M_strnormal;
Labelartifice. Text = M_strartifice; // When editing mode, three labels cannot get the value.
< Edititemtemplate >
< ASP: textbox ID = " Txtfexerciseamount " Cssclass = " Necessarycss " Runat = " Server " Text = ' <% # BIND ("fexerciseamount") %> '
Maxlength = " 3 " Onkeyup = " Value = value. Replace (/[^ \ D]/g ,'') " Value = ' Only numbers can be entered ' Onfocus = " If (value = 'only numbers allowed ') {value = ''} "
Onblur = " Return countvalidate (); " > </ ASP: textbox >
< ASP: regularexpressionvalidator ID = " Regularexpressionvalidator1 " Runat = " Server " Errormessage = " The question Count must be an integer! " Display = " Dynamic "
Controltovalidate = " Txtfexerciseamount " Validationexpression = " [1-9] \ D * " > </ ASP: regularexpressionvalidator >
Total number of questions: < ASP: Label runat = " Server " ID = " Labelsum " > </ ASP: Label > (Basic questions: < ASP: Label runat = " Server " ID = " Labelnormal " > </ ASP: Label > & Nbsp; & Nbsp; & Nbsp; tips: < ASP: Label runat = " Server " ID = " Labelartifice " > </ ASP: Label > )
</ Edititemtemplate >
Three labels can be assigned to all the values during breakpoint debugging, but the value remains unchanged when the page is displayed.
Have you used all kinds of methods to solve the problem? Paste it in the garden to consult experts.