Although I learned this language when I was in my sophomore year, it was useless for a long time. It was easy to design the course. Now I am in the internship unit. I have to start from scratch. The following are basic things. Let's take a look ....
1. <asp: TemplateField HeaderText = "itinerary" ItemStyle-Width = "80px" ItemStyle-HorizontalAlign = "Left"> <ItemTemplate> <asp: hyperLink ID = "Routing" runat = "server" Target = "_ blank" Enabled = '<% # Convert. toBoolean (Eval ("IsLockedPartyInfo "). toString () = "empty "? "False": Eval ("IsLockedPartyInfo "). toString () = false %> 'text = '<% # Eval ("PartyPlanJourney") %> 'navigateurl =' <% # "Routing. aspx? Id = "+ Eval (" ID ") +" "%> '> </asp: HyperLink> </ItemTemplate>
This section is about binding a hyperlink. However. I do not understand <% # Convert. ToBoolean (Eval ("IsLockedPartyInfo"). ToString () = "empty "? "False": Eval ("IsLockedPartyInfo"). ToString () = false %. So we have the following explanation.
<% # Eval ("Id ","~ /Search. aspx? Id = {0} ") %> This is the format of the bound data
For example, <% # Eval ("Id", "{0}") %>, the previous id indicates the id field or alias in the database, the following {0} indicates that the first parameter is output. The first parameter here is the id
Therefore, <% # Eval ("Id ","~ /Search. aspx? Id = {0} ") %> the output is ~ /Search. aspx? Id = 120. Here, 120 is the output format of {0 }.
This is the data binding format. {0} indicates the first data in the array. The first one here is id. Eval is the data value obtained from the database from the bound data source, and id is the data table field you obtained.
Example <% # Eval ("Id, Name ","~ /Search. aspx? Id = {0} & name = {1} ") %> here, 1 is the name value read by the database. Of course, name is random, this field is required in your data column. The sequence of the array starts from 0, so 0 represents what we think 1.