Hi guys,
I have asp.net page, where i'm repeater in which i have 86 rows.
In each row i have some dropdownlist and textboxes.
i want to Populate dropdownlist which is in a repeater.
The problem is, it is taking more time to load the page(binding each dropdownlist).
Is there any way, from where i can easily bind these dropdownlist, which take more time to load.
please help me.
Thanks
What I have tried:
<table width="100%" class="addgrid">
<thead>
<tr style="background-image: removed('NewTheam/images/Background.png'); height: 30px;
color: Black; vertical-align: middle;">
<th>
Truck No#
</th>
<th>
Plate No#
</th>
<th>
Type
</th>
<th>
Status
</th>
<th>
Rig
</th>
<th>
Well
</th>
<th>
Location
</th>
<th>
Driver
</th>
<th>
Recent Date
</th>
<th>
Job Date
</th>
<th>
<center>
<asp:Image ID="Image1" runat="server" ImageUrl="~/images/checkmark.gif" Width="23"
Height="20" /></center>
</th>
</tr>
</thead>
<tbody id="tBodyVT">
<asp:Repeater ID="Repeater1" runat="server"
onitemdatabound="Repeater1_ItemDataBound">
<ItemTemplate>
<tr class="">
<td>
<%# Eval("TruckNumber") %>
</td>
<td>
<%# Eval("PlateNumber")%>
</td>
<td>
<%# Eval("VehicleType")%>
</td>
<td>
<asp:DropDownList ID="ddlstatus" runat="server">
<asp:ListItem Value="-1" Text="--Select--" Selected="True"></asp:ListItem>
<asp:ListItem Value="1" Text="Active"></asp:ListItem>
<asp:ListItem Value="0" Text="InActive"></asp:ListItem>
</asp:DropDownList>
</td>
<td>
<asp:DropDownList ID="ddlrig" runat="server">
</asp:DropDownList>
</td>
<td>
<asp:DropDownList ID="ddlwell" runat="server" CssClass="myWell">
</asp:DropDownList>
</td>
<td>
<asp:TextBox ID="txtlocation" runat="server" ></asp:TextBox>
</td>
<td>
<asp:DropDownList ID="ddldriver" runat="server">
</asp:DropDownList>
</td>
<td>
<%# Eval("JobDate")%>
</td>
<td class="vmiddle calendarContainerOverride" style="width: 80px; padding: 0 8px;
line-height: 20px;">
<asp:TextBox ID="txtJobDate" CssClass="txtbox_namenormal" runat="server" Width="80px"></asp:TextBox>
<ajaxToolkit:CalendarExtender ID="calendarButtonExtenderRp" CssClass="cal_Theme1"
runat="server" TargetControlID="txtJobDate" PopupButtonID="txtJobDate" />
</td>
<td>
<center>
<asp:CheckBox ID="chk" runat="server" />
</center>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</tbody>
<tfoot>
</tfoot>
</table>
code file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using DataAccessLayer;
public partial class AddVehicleTracking : System.Web.UI.Page
{
Rig_BL rig = new Rig_BL();
Well_BL well = new Well_BL();
DataTable dt = new DataTable();
DataTable dt_rig = new DataTable();
DataTable dt_well = new DataTable();
DataTable dt_Driver = new DataTable();
PopulateDropDownList pddl = new PopulateDropDownList();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
dt = VehicleTracking_BL.GetVehiclesForInsert();
Repeater1.DataSource = dt;
Repeater1.DataBind();
MySession.Current.RigDT = rig.GetAllRigs();
MySession.Current.WellDT = well.GetAllWells(false, null);
MySession.Current.DriverDT = Driver_BL.GetDrivers();
}
}
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
int index = 0;
int count = Repeater1.Items.Count;
while (index < count)
{
DropDownList ddl_rig = (DropDownList)Repeater1.Items[index].FindControl("ddlrig");
DropDownList ddl_well = (DropDownList)Repeater1.Items[index].FindControl("ddlrig");
DropDownList ddl_driver = (DropDownList)Repeater1.Items[index].FindControl("ddlrig");
if (MySession.Current.RigDT.Rows.Count > 0)
{
pddl.PopDDL(ddl_rig, MySession.Current.RigDT, "Rig_Name", "RigID");
}
if (MySession.Current.WellDT.Rows.Count > 0)
{
pddl.PopDDL(ddl_well, MySession.Current.WellDT, "Well_Name", "WellID");
}
if (MySession.Current.DriverDT.Rows.Count > 0)
{
pddl.PopDDL(ddl_driver, MySession.Current.DriverDT, "EmpName", "RecID");
}
if (dt.Rows.Count > 0)
{
}
index++;
}
}