Asp.net| Link Display detail page with link
In the previous use of Ultradev to link to the display of detailed data pages are generally through the "Go to Detail Page" server behavior, and the net environment in the Server Behavior window does not provide the behavior, then link how to do? The answer is still in the settings of the DataGrid control.
For the convenience of illustration, we also put the elements of the detail page on the Default.aspx page.
Setting up a Recordset "DataSet2" to display the details is simple, as the figure simply sets the "XID" parameter that the ordinal number is passed over to the URL.
Insert a table in the page, bind the fields in the "DataSet2" recordset to the appropriate location, and do not forget to use the server Behaviors→show region→show if Dateset is not empty behavior setting when "Datase" T2 hide the table when the recordset is empty, as shown in the following figure.
Once we're done, we'll edit the DataGrid control again, set the sequence number to pass the "XID" argument in the dialog box, select "Serial number" in the "Columns" field, and then click the "Change column type" switch in the lower button to select "Hyperlink" Hyperlink item
In the pop-up "Hyperlink culumn" dialog box, set the following
Title: "Ordinal"--Displays the title of the column
Hyperlink text:--hyperlink text, which includes three items
Static text:--You can write text as a link here
Data field: "Ordinal"-You can select a field in the recordset to use as a link
Format string:--You can define the display format of a field
Linked page:--link to the page, there are also three items
Static url:--linked to a still page
Date field: Ordinal--this refers to selecting the ordinal field as the parameter value passed to the next page
Format string: "Default.aspx?xid={0}"--Use the button on the right to select the page to link to, our detail records are also selected on this page "default.aspx" to generate the preceding string, Note that the automatically generated parameter name is the "ordinal" text in Chinese, and we specify the parameter named "XID" when we set up the "DataSet2" Recordset, so we need to modify it manually.
After the completion of the following figure
Click "OK" to return to the disk test.
Some of the other supplements
1. We have used four display types in the DataGrid control and have a basic idea of how they are used, and there is a "free Form" left. This is a relatively free display type where you can add a few dynamic records or add text to it, or it can be an expression control, which is a flexible display tool.
2. Do you remember when we edited the "Hyperlink culumn" Hyperlink dialog box with a "format String" item set to empty, and if so, how to set it? After browsing through the ASP.net document we made the following attempt to add the string "{0:x}" in this box, as shown below
After saving, we can see the following image in the browser
The ordinal field displays a numeric value in hexadecimal format, because on the format character "X", the following are a few format character descriptions
C Displays the value in currency format.
D displays numeric values in decimal format.
E displays values in scientific notation (exponential) format.
F displays values in a fixed format.
G displays numeric values in a regular format.
N displays numeric values in numeric format.
X Displays the numeric value in hexadecimal format.
3. What if the link to the "Ordinal" field is opened in the form of a new window? This does not seem to be available in the DataGrid control, so let's try changing the source code. Go to the source window and find the code corresponding to the "ordinal" field:
--> <>
Datanavigateurlfield= "Serial Number"
datanavigateurlformatstring= "Default.aspx?xid={0}"
Datatextfield= "Serial Number"
Visible= "True"
headertext= "Serial number"/>
At the end of the code, add the "target=" _new "" string to make it
<>
Datanavigateurlfield= "Serial Number"
datanavigateurlformatstring= "Default.aspx?xid={0}"
Datatextfield= "Serial Number"
Visible= "True"
headertext= "Serial Number"
target= "_new"/>
Okay, so that's it, and when you click on the link on the serial number again, it appears as a new window.
The Dreamweaver of the DataGrid control in the ASP.net environment in MX This is it, of course, you can use to modify the code to get more functionality, or the old saying, Dreamweaver MX in your development asp.net can provide efficiency, and currently has a very poor function, so see the source code, understand the source or use a good Dreamweaver mx key.