Recently, when doing a page pass value, encountered a problem, the problem is restored:
The first page uses the data source control to Databindcontrol The bound data source, and then uses the HyperLinkField control to bind the background data. and pass parameters to the second page. The data binding code is as follows:
<span style= "FONT-SIZE:18PX;" ><soa:deluxeobjectdatasourcerunat= "Server" enablepaging= "True" id= "Datasourceservicepack" TypeName= " SinoOcean.Seagull2.TransactionData.PlanManage.ReportHelper.GenerrateKeyPointAchievingRateOfServicepack () "/> The page pass value code is as follows: <asp:hyperlinkfielddatanavigateurlfields= "Plancode,planversionstarttime,begintime,endtime" Datanavigateurlformatstring= "Delaykeypointtaskofservicepack.aspx? PLANCODE={0}&PLANVERSIONSTARTTIME={1}&BEGINTIME={2}&ENDTIME={3} " target=" _blank "Text=" view " headertext= "View"/></span>
The problem occurs, after running the code, found that the hyperlink button on the page is not in the click State, the analysis found that after the deletion of the time parameter, the button is available, then why is this the situation? Baidu, originally is the time format problem, originally bound data source, the data source time format is "yyyy-mm-dd HH:mm:ss.fff", Degree Niang said, the address bar does not recognize the special symbol, therefore, this link cannot click.
Since the format is not difficult to change Bai, for a can pass the past is not OK? Immediately hands, tried a bit, instead of "Yyyy/mm/ddhh/mm/ss.fff", sure enough to pass, the value of the problem solved, But new problems have arisen again.
After the success of the data transmission, or can not be normal query, found that the time after the format can not be normal data query, the original or the format is not right, then how to do? Change the new page back to chant.
continue to Baidu, found a solution, that is, the string division conversion method, first, the string is divided into multiple parts, and then converted, can be.
My string is divided into two parts, the first part needs to convert the special characters in the middle of the date to the horizontal small short, the second part needs to convert the special characters to colons, the conversion method is different, then separates the conversion.
When the page is passed, redesign the string delivery format to "Yyyy/mm/dd THh/mm/ss.fff" format, and then according to T as a delimiter, divided into two strings, respectively, the code is as follows.
<span style= "FONT-SIZE:18PX;" >stringversionstarttime =webutility.getrequestquerystring ("Planversionstarttime", "" "); if (versionstarttime! = "") { string ss =versionstarttime.split (' T ') [0]. ToString (); String ee =versionstarttime.split (' T ') [1]. ToString (); Versionstarttime =ss. Replace ('/', '-') + "" + EE. Replace ('/', ': '); } </span>
The data conversion is successful and can be queried normally.
How special characters are passed between pages