Here is the markup code in the .aspx
file that illustrates how you can use the PagerTemplate of the FormView control to
display a customized pager. Note that the AllowPaging property should be set to
true to enable paging for the control.
CommandArgument="First" Text="First" RunAt="server"/>
|
CommandArgument="Prev" Text="Prev" RunAt="server"/>
|
CommandArgument="Next" Text="Next" RunAt="server"/>
|
CommandArgument="Last" Text="Last" RunAt="server"/>
|
Displaying Views of Data (Part II)
[ 202 ]
Here is the complete source code for the FormView control with the customized
formatting we have just discussed.
BackColor="White" DefaultMode="ReadOnly"
BorderColor="Red" BorderStyle="Solid" EmptyDataText="No Records"
BorderWidth="1px" CellPadding="3" CellSpacing="2"
DataKeyNames="EmployeeID" DataSourceID="SqlDataSource1"
GridLines="Both">
ForeColor="White" />
Employee ID:Text='<%# Eval("EmployeeID") %>'>
Employee Name:Text='<%# Bind("EmployeeName") %>'>
Joining Date:
Salary:Text='<%# Bind("Salary","{0:c}") %>'>
Department Name:
runat="server" DataSourceID="SqlDataSource2"
DataTextField="DepartmentName"DataValueField=
"DepartmentI D"
SelectedValue='<%# Eval("DepartmentID") %>' />
CommandArgument=?»First?» Text=?»First?» RunAt=?»server?»/> |
CommandArgument=?»Prev?» Text=?»Prev?» RunAt=?»server?»/> |
Chapter 7
[ 203 ]
CommandArgument=?»Next?» Text=?»Next?» RunAt=?»server?»/> |
CommandArgument=?»Last?» Text=?»Last?» RunAt=?»server?»/> |
ForeColor=?»White?» />
The markup code for the data source controls used for binding data to the FormView
control and the DropDownList control contained within it is shown as follows:
ConnectionString="Data Source=.
Pages:
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194