I have multiple tabs on my page and currently I am binding all dropdownlists on every tab at page load.
I want to bind the dropdownlists only when the tab is selected. I also want to clear the gridviews when the tab is changed.
This is my HTML code
<li>
<input type="radio" id="tab1d" name="tabs1" runat="server"/>
<label for="tab1d">Search</label>
<div id="tab-content1d" class="tab-content animated fadeIn" style="background-color:white; padding:10px; ">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label4" runat="server" Text="Select Platform"></asp:Label>
<asp:DropDownList ID="DropDownList3" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DropDownList3_SelectedIndexChanged" CssClass="inputs" Width="150px"></asp:DropDownList>
<asp:Label ID="Label10" runat="server" Text="Select Family Name"></asp:Label>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true" CssClass="inputs" Width="150px" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"></asp:DropDownList>
<asp:Label ID="Label11" runat="server" Text="Select price Level"></asp:Label>
<asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="true" CssClass="inputs" Width="150px" ></asp:DropDownList>
<asp:Button ID="Button7" runat="server" Text="Search" CssClass="buttons" OnClick="Button7_Click"/><br /><br />
<div id="gdvLeft">
<asp:GridView ID="gdvFamilyname" runat="server" EnableViewState="True" class="grid" RowStyle-CssClass="rows"></asp:GridView>
</div>
<div id="gdvRight">
<asp:GridView ID="gdvQuantity" runat="server" EnableViewState="True" class="grid" RowStyle-CssClass="rows"></asp:GridView>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</li>
Hi Himani, Try like this -
<input type="radio" value="Click Me" onclick="rdioClick();" />
In Javascript -
function rdioClick() {
var GridView1 = document.getElementById('GridView1');
GridView1.innerHTML = "";
}
Thanks :)
i cannot find my hiddenfield2 in the back end code . So how can i get the value of this hiddenfiled using asp.net(vb)
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="list_election">
<form>
<asp:DropDownList ID = "ddlElectionCategorie" runat="server" AutoPostBack="true">
</asp:DropDownList>
</form>
</div>
<div class="row">
<asp:Repeater ID="rpVoteList" runat="server" >
<ItemTemplate>
<div class="col-md-4 ">
<div class="voter">
<h4><%# Eval("List_Nom")%></h4>
<asp:HiddenField ID="hfListId" runat="server" Value='<%# Eval("Id")%>' />
<form>
'this is a nested radiobutton list in a repeater
<asp:HiddenField ID="HiddenField2" runat="server" Value='<%# Eval("Id")%>' />
<asp:RadioButtonList ID="RbCandidat" runat="server"></asp:RadioButtonList>
</form>
</div>
</div>
</ItemTemplate>
</asp:Repeater>
</div>
<asp:Button ID="Button1" runat="server" Text="Button" />
</asp:Content>
C#:
foreach (RepeaterItem item in rpVoteList.Items)
{
if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
{
var hf= (HiddenField)item.FindControl("HiddenField2")
}
}
Or
protected void rpVoteList_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
var value = (HiddenField) e.Item.FindControl("HiddenField2")).Value;
}
I have an UpdatePanel that has another Panel inside to mimic a simple pop-up window.
Inside the Panel I have a HTML Table, with several rows and a few columns, and a GridView in one row and a DetailsView further down.
There is also an SUBMIT and a CANCEL button on the HTML table side.
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:PostBackTrigger ControlID="ButtonSubmit" />
<asp:PostBackTrigger ControlID="ButtonCancel" />
</Triggers>
<ContentTemplate>
<asp:Panel ID="pnlRoomDetails" runat="server" CssClass="pnlDetail" Visible="false" Width="500px">
<table id="tblDetails" runat="server" style="width: 100%">
<tr style="height:26px;">
<td colspan="6" style="font-size: 12pt; color: yellow; font-family: Arial; background-color: blue;
text-align: center" valign="middle">
<strong>Room Allocation</strong></td>
</tr>
<tr>
<td colspan="1" style="text-align: left; vertical-align: middle; width: 128px; height: 24px;" valign="top">
<strong>
Room ID</strong></td>
<td colspan="3" style="width: 357px; text-align: left; vertical-align: middle; height: 24px;">
<asp:Label ID="lblRoomID" runat="server" Text="Label" Font-Bold="true"></asp:Label></td>
<td colspan="1" style="vertical-align: middle; width: 106px; height: 24px; text-align: left">
<strong>
Available?</strong></td>
<td colspan="1" style="vertical-align: middle; width: 120px; height: 24px; text-align: left">
<asp:CheckBox ID="cbStatus" runat="server" Width="98px" Enabled="False" /></td>
</tr>
<tr>
<td colspan="1" style="text-align: left; vertical-align: middle; width: 128px; height: 24px;" valign="top">
<strong>
Name</strong></td>
<td colspan="3" style="width: 357px; text-align: left; vertical-align: middle; height: 24px;">
<asp:Label ID="lblRoomName" runat="server" Text="Label"></asp:Label></td>
<td colspan="1" style="vertical-align: middle; width: 106px; height: 24px; text-align: left">
<strong>
Configuration</strong></td>
<td colspan="1" style="vertical-align: middle; width: 120px; height: 24px; text-align: left">
<asp:Label ID="lblRoomConfigName" runat="server" Text="Label"></asp:Label></td>
</tr>
<tr>
<td colspan="1" style="vertical-align: middle; width: 128px; height: 24px; text-align: left"
valign="top">
<strong>Max Beds</strong></td>
<td colspan="3" style="vertical-align: middle; width: 357px; height: 24px; text-align: left">
<asp:Label ID="lblBeds" runat="server" Text="Label"></asp:Label></td>
<td colspan="1" style="vertical-align: middle; width: 106px; height: 24px; text-align: left">
</td>
<td colspan="1" style="vertical-align: middle; width: 120px; height: 24px; text-align: left">
</td>
</tr>
<tr>
<td colspan="1" style="vertical-align: middle; width: 128px; height: 24px; text-align: left"
valign="top">
<strong>Room Comments</strong></td>
<td colspan="5" style="vertical-align: middle; height: 24px; text-align: left">
<asp:TextBox ID="tbComments" runat="server" Enabled="False" Height="47px" MaxLength="8"
ReadOnly="True" Style="text-align: left" TextMode="MultiLine" Width="98%"></asp:TextBox></td>
</tr>
<tr>
<td colspan="6">
<asp:Label ID="lblMsg" runat="server" Visible="False" Width="100%" BackColor="Red" Font-Bold="True" Font-Names="Arial" ForeColor="Yellow" style="text-align:center"></asp:Label>
<asp:GridView ID="gvAllocations" runat="server" AllowSorting="True" CellPadding="4"
ForeColor="#333333" GridLines="None" AutoGenerateColumns="False" Font-Names="Arial Narrow" Font-Size="10pt"
DataSourceID="sdsAllocations" DataKeyNames="BoardingCheckinID"
OnRowDataBound="gvAllocations_RowDataBound"
OnDataBound="gvAllocations_DataBound">
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<Columns>
<asp:TemplateField HeaderText="Tenant" SortExpression="TenantName">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("TenantName") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Left" />
</asp:TemplateField>
<asp:TemplateField HeaderText="ID" SortExpression="TenantID">
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Eval("TenantID") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Bed" SortExpression="BedName">
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Eval("BedName") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Checked IN" SortExpression="DateCheckedIn">
<ItemTemplate>
<asp:Label ID="lblDateCheckIn" runat="server" Text='<%# Eval("DateCheckedIn","{0:g}") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Right" />
</asp:TemplateField>
<asp:TemplateField Visible="false" ShowHeader="false">
<ItemTemplate>
<asp:Label ID="lblCheckedInBy" runat="server" Text='<%# Eval("CheckedInBy") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Expected Check Out" SortExpression="ExpectedCheckOut">
<ItemTemplate>
<asp:Label ID="Label6" runat="server" Text='<%# Eval("ExpectedCheckOut","{0:g}") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Right" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Notes" SortExpression="Notes">
<ItemTemplate>
<asp:Label ID="Label7" runat="server" Text='<%# Eval("Notes") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Left" />
</asp:TemplateField>
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:LinkButton ID="lnkDEL" runat="server" CausesValidation="False" CommandName="Delete" Text="DEL" OnClientClick="return confirm('Are you sure?');"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#999999" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>
<asp:SqlDataSource ID="sdsAllocations" runat="server" ConnectionString="<%$ ConnectionStrings:ATCNTV1ConnectionString %>" CancelSelectOnNullParameter="False"
SelectCommand="SELECT bc.BoardingCheckinID, bc.BoardingRoomID, ISNULL(bc.TenantID, bc.StudentID) AS TenantID, v1.StudentPreferredName + ' ' + v1.StudentFamilyName AS TenantName, bc.BedID, bb.BedName, bc.BoardingTypeID, brt.TypeName, bc.DateCheckedIn, bc.CheckedINby, bc.ExpectedCheckOut, bc.Notes FROM tblBoardingCheckins AS bc INNER JOIN vwBoardingTenants AS v1 ON v1.StudentID = bc.StudentID AND v1.Year = YEAR(GETDATE()) INNER JOIN tblBoardingBeds AS bb ON bb.BedID
= bc.BedID INNER JOIN tblBoardingRooms AS br ON br.BoardingRoomID = bc.BoardingRoomID INNER JOIN tblBoardingRoomTypes AS brt ON brt.BoardingTypeID = bc.BoardingTypeID WHERE (bc.IsActive = 1) AND (bc.DateCheckedIn <= GETDATE()) AND (bc.ExpectedCheckOut >= GETDATE()) AND (bc.BoardingRoomID = #RoomID) ORDER BY bc.DateCheckedIn DESC"
DeleteCommand="UPDATE tblBoardingCheckins SET IsActive = 0 WHERE BoardingCheckinID = #BoardingCheckinID">
<SelectParameters>
<asp:ControlParameter ControlID="lblSelectedRoomID" Name="RoomID" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="BoardingCheckinID" />
</DeleteParameters>
</asp:SqlDataSource>
</td>
</tr>
<tr>
<td colspan="6">
<asp:DetailsView ID="dvRoomCheckIn" runat="server" AutoGenerateRows="False" DefaultMode="Insert" CellPadding="3"
Width="100%" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" OnDataBound="dvRoomCheckIn_DataBound">
<FooterStyle BackColor="White" ForeColor="#000066" />
<PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
<Fields>
<asp:BoundField DataField="BoardingBookingID" ReadOnly="True" Visible="False" />
<asp:TemplateField HeaderText="Pick Student">
<ItemTemplate>
<asp:DropDownList ID="ddlTenant" runat="server" DataSourceID="sdsTenants" DataTextField="StudentName" DataValueField="StudentID" AppendDataBoundItems="true">
<asp:ListItem Selected="True" Text="Please select.." Value="0"></asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="sdsTenants" runat="server" ConnectionString="<%$ ConnectionStrings:ATCNTV1ConnectionString %>"
SelectCommand="WITH cte AS (SELECT CASE WHEN bc.StudentID IS NULL THEN v1.StudentID ELSE NULL END AS StudentID, CASE WHEN bc.StudentID IS NULL THEN (v1.StudentPreferredName + ' ' + v1.StudentFamilyName) ELSE NULL END AS StudentName FROM vwBoardingTenants AS v1 LEFT OUTER JOIN tblBoardingCheckins AS bc ON v1.StudentID = bc.StudentID AND bc.DateCheckedIn <= GETDATE() AND bc.ExpectedCheckOut >= GETDATE() AND bc.IsActive = 1 WHERE (v1.Boarding = 'Y') AND (v1.Year = YEAR(GETDATE()))) SELECT StudentID, StudentName FROM cte AS cte_1 WHERE (StudentID IS NOT NULL) ORDER BY StudentName">
</asp:SqlDataSource>
<asp:RequiredFieldValidator ID="rfvTenant" runat="server" ControlToValidate="ddlTenant" ErrorMessage="Required" InitialValue="0" ValidationGroup="vg1"></asp:RequiredFieldValidator>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Choose Bed">
<ItemTemplate>
<asp:DropDownList ID="ddlBeds" runat="server" DataSourceID="sdsBeds" DataTextField="BedName" DataValueField="BedID" OnDataBound="ddlBeds_DataBound">
<asp:ListItem Selected="True" Text="Select.." Value=""></asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="sdsBeds" runat="server" ConnectionString="<%$ ConnectionStrings:ATCNTV1ConnectionString %>"
SelectCommand="SELECT BedID, BedName FROM tblBoardingBeds WHERE BedID <= #BedMax ORDER BY BedName">
<SelectParameters>
<asp:ControlParameter ControlID="lblBeds" Name="BedMax" Type="Int16" />
</SelectParameters>
</asp:SqlDataSource>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Check IN">
<ItemTemplate>
<table width="100%">
<tr>
<td>
<asp:Label ID="lblCheckedIN" runat="server" Text='<%# Eval("DateCheckedIn","{0:g}") %>' Width="70%"></asp:Label>
</td>
<td>
<strong style="text-align: center">BY</strong>
</td>
<td>
<asp:Label ID="lblCheckedINby" runat="server" Text='<%# Eval("CheckedINby") %>' Enabled="false"></asp:Label>
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Check OUT by">
<ItemTemplate>
<table width="100%">
<tr>
<td>
<asp:TextBox ID="txtCheckOUT" runat="server" Text='<%# Bind("ExpectedCheckOut") %>' Width="80"></asp:TextBox>
<asp:ImageButton runat="Server" ID="calImg" ImageUrl="~/images/Calendar_scheduleHS.png" AlternateText="Click to show calendar" CausesValidation="False" />
<ajaxToolkit:CalendarExtender PopupButtonID="calImg" Enabled="true" TargetControlID="txtCheckOUT" ID="ce1" runat="server" Format="d/MM/yyyy" PopupPosition="TopRight"></ajaxToolkit:CalendarExtender>
<asp:RequiredFieldValidator SetFocusOnError="true" ValidationGroup="vg1" ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtCheckOUT" ErrorMessage="Date is required">*</asp:RequiredFieldValidator>
<asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="txtCheckOUT" Operator="DataTypeCheck" Type="Date" Display="Dynamic" ErrorMessage="Invalid Date (d/M/yyyy)" SetFocusOnError="True"></asp:CompareValidator>
<asp:CompareValidator ID="CompareValidator2" runat="server" ControlToValidate="txtCheckOUT" Operator="GreaterThan" Type="Date" Display="Dynamic" ValueToCompare='<%# DateTime.Today.ToShortDateString() %>' ErrorMessage="Check out date must be greater than Checked IN date!" SetFocusOnError="True"></asp:CompareValidator>
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Comments" SortExpression="Notes">
<ItemTemplate>
<asp:TextBox ID="txtNotes" runat="server" Text='<%# Bind("Notes") %>' Width="98%" Rows="5" TextMode="MultiLine"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Fields>
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
<RowStyle ForeColor="#000066" />
</asp:DetailsView>
</td>
</tr>
<tr>
<td colspan="6" style="text-align: center">
<asp:Button ID="ButtonSubmit" runat="server" Text="Submit" OnClick="Submit_Click" CausesValidation="true" ValidationGroup="vg1" />
<%--
<input id="ButtonSubmit" runat="server" value="Submit" type="button" validationgroup="vg1" onserverclick="Submit_Click" causesvalidation="true" />
<input id="ButtonSubmit" runat="server" type="button" value="Submit" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions('ButtonSubmit', '', true, 'vg1', '', false, false))"/>
--%>
<asp:Button ID="ButtonCancel" runat="server" Text="Cancel" OnClick="Cancel_Click" CausesValidation="false"/>
</td>
</tr>
</table>
</asp:Panel>
</ContentTemplate> </asp:UpdatePanel>
The Submit button fires this code ...
protected void Submit_Click(object sender, EventArgs e)
{
//find button used to get here
Button btnRoomClicked = (Button)pnlRoomDetails.FindControl("Room" + lblSelectedRoomID.Text);
if (btnRoomClicked != null)
{
//reset colours
btnRoomClicked.Font.Bold = false;
}
//Check In!
using (SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["ATCNTV1ConnectionString"].ConnectionString))
{
cnn.Open();
try
{
//prepare command
using (SqlCommand cmd = new SqlCommand("spBoardingCheckIN", cnn))
{
cmd.CommandType = CommandType.StoredProcedure;
DropDownList ddlTenant = (DropDownList)dvRoomCheckIn.FindControl("ddlTenant");
if (ddlTenant != null) cmd.Parameters.Add("#StudentID", SqlDbType.Char).Value = ddlTenant.SelectedValue.ToString();
cmd.Parameters.Add("#TenantID", SqlDbType.VarChar).Value = string.Empty;
DropDownList ddlBed = (DropDownList)dvRoomCheckIn.FindControl("ddlBeds");
if (ddlBed != null) cmd.Parameters.Add("#BedID", SqlDbType.Int).Value = ddlBed.SelectedValue.ToString();
cmd.Parameters.Add("#BoardingRoomID", SqlDbType.Int).Value = lblSelectedRoomID.Text;
cmd.Parameters.Add("#BoardingTypeID", SqlDbType.Int).Value = 2; //Boarder types only at this stage
cmd.Parameters.Add("#StaffID", SqlDbType.VarChar).Value = (Session["StaffID"] != string.Empty) ? Session["StaffID"].ToString() : "0000000001"; //default to Admin if null
TextBox txtCheckOUT = (TextBox)dvRoomCheckIn.FindControl("txtCheckOUT");
if (txtCheckOUT != null) cmd.Parameters.Add("#ExpectedCheckOut", SqlDbType.DateTime).Value = DateTime.Parse(txtCheckOUT.Text);
TextBox txtNotes = (TextBox)dvRoomCheckIn.FindControl("txtNotes");
if (txtNotes != null) cmd.Parameters.Add("#Notes", SqlDbType.VarChar).Value = txtNotes.Text;
//run query
int tst = cmd.ExecuteNonQuery();
if (tst != 1) throw new Exception("The Insert command did not work! tst=" + tst.ToString() + " ");
}
}
catch (Exception ex)
{
lblMsg.Text = ex.Message + " - " + ex.StackTrace;
}
//re-enable main panel and hide details panel
pnlRoomDetails.Visible = false;
pnlMAIN.Enabled = true;
gvCurrCheckIns.DataBind();
//update the motel layout
MotelFormat();
}
}
The problem is that when ever I SUBMIT a new tenant into the GridView gvAllocations, sometimes the server does a PostBack, other times it does nothing and the page is refreshed without the new entry shown in the Gridview. However, in the later case the page is refreshed properly after about 15-20 seconds and I can see the new tenant added into the GridView. Other times, it happens instantly.
I've tested the SQL server side-by-side with this, and the INSERT is working and I can see the new row immediately, but for some reason the ASP.net page does not register this, but only after 15-20 seconds. And as I said, this happens some of the time, which is even more frustrating.
Strangely, when ever I delete a tenant from the gvAllocations GridView, the whole thing works perfectly.
I am not sure if it's the UpdatePanel the issue here, or that this is perhaps poor design on my part and I should have used a FormView for the entire thing. Can you have FormViews inside UpdatePanels? Do I even need an UpdatePanel?
I've read this, and putting the ScriptManager RegisterPostBackControl() did not change anything for me.
Incidentally, the SUBMIT button renders as follows ...
<input type="submit" name="ctl00$ContentPlaceHolder1$ButtonSubmit" value="Submit" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolder1$ButtonSubmit", "", true, "vg1", "", false, false))" id="ctl00_ContentPlaceHolder1_ButtonSubmit">
The CANCEL button does not have the WebForm_DoPostBackWithOptions(). Why?
Thank you for your time.
Well it looks like no one could help me out here and I was about to place a Bounty, but I found the culprit!
Yep - you've guessed it - Parameter Sniffing! It took me 4 days to figure it out.
The dvRoomCheckIn DetailsView had three parameters pre-designed into the control by myself, as you can see in the above code - the parameters were DateCheckedIn, CheckedINby, and ExpectedCheckOut.
The Stored Procedure was like this ...
CREATE PROCEDURE [dbo].[spBoardingCheckIN]
#StudentID CHAR(10),
#TenantID VARCHAR(20) = NULL,
#BedID INT,
#BoardingRoomID INT,
#BoardingTypeID INT,
#StaffID VARCHAR(10),
#ExpectedCheckOut DATETIME,
#Notes VARCHAR(5000)
AS
BEGIN
INSERT INTO tblBoardingCheckins(StudentID,
TenantID,
BedID,
BoardingRoomID,
BoardingTypeID,
DateCheckedIn,
CheckedINby,
ExpectedCheckOut,
Notes,
IsActive)
VALUES (#StudentID,
#TenantID,
#BedID,
#BoardingRoomID,
#BoardingTypeID,
GETDATE(),
#StaffID,
CONVERT(DATETIME, #ExpectedCheckOut, 121),
#Notes,
1)
END
GO
So what happened was that since I did not specify those three parameters into the Stored Procedure (I've defaulted the values and only mentioned one of them), the ASP.net (or SQL server?) went to find the values for the other two parameters that I mentioned in the DetailsView.
The way I fixed it was to specify all the Parameters that ASP.net expected, and therefore I changed the Stored Procedure and the parameter list in ASP.net to reflect the exact number of parameters expected, so as to avoid the program going into "sniffing" mode for those values.
ie
CREATE PROCEDURE [dbo].[spBoardingCheckIN]
#StudentID CHAR(10),
#TenantID VARCHAR(20) = NULL,
#BedID INT,
#BoardingRoomID INT,
#BoardingTypeID INT,
#DateCheckedIn DATETIME,
#CheckedINby VARCHAR(10),
#ExpectedCheckOut DATETIME,
#Notes VARCHAR(5000)
AS
BEGIN
INSERT INTO tblBoardingCheckins(StudentID,
TenantID,
BedID,
BoardingRoomID,
BoardingTypeID,
DateCheckedIn,
CheckedINby,
ExpectedCheckOut,
Notes,
IsActive)
VALUES (#StudentID,
#TenantID,
#BedID,
#BoardingRoomID,
#BoardingTypeID,
#DateCheckedIn,
#CheckedINby,
CONVERT(DATETIME, #ExpectedCheckOut, 121),
#Notes,
1)
END
GO
And the SqlDataSource in ASP.net is thus ...
<asp:SqlDataSource ID="sdsCheckinEntries" runat="server" ConnectionString="<%$ ConnectionStrings:ATCNTV1ConnectionString %>"
InsertCommand="spBoardingCheckIN" InsertCommandType="StoredProcedure" EnableCaching="false">
<InsertParameters>
<asp:ControlParameter ControlID="dvRoomCheckIn$ddlTenant" Name="StudentID" Type="string" />
<asp:Parameter Name="TenantID" Type="string" DefaultValue="" ConvertEmptyStringToNull="true" />
<asp:ControlParameter ControlID="dvRoomCheckIn$ddlBeds" Name="BedID" Type="int16" />
<asp:ControlParameter ControlID="lblSelectedRoomID" Name="BoardingRoomID" Type="Int16" />
<asp:Parameter Name="BoardingTypeID" Type="int16" DefaultValue="2" />
<asp:ControlParameter ControlID="dvRoomCheckIn$lblCheckedIN" Name="DateCheckedIn" Type="DateTime" />
<asp:ControlParameter ControlID="dvRoomCheckIn$lblCheckedINby" Name="CheckedINby" Type="string" />
<asp:ControlParameter ControlID="dvRoomCheckIn$txtCheckOUT" Name="ExpectedCheckOut" Type="DateTime" />
<asp:ControlParameter ControlID="dvRoomCheckIn$txtNotes" Name="Notes" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
So yeah lessoned learnt! Don't assume that just because a parameter exists in a control that it's automatically and directly linked to the datasource. Sometimes, the program may not "find it" and has to go looking for values in relation to the parameters missing.
A great resource - if not the best I've found so far is this. It explains everything.
I hope this will help someone else out there pulling their hair out!
Cheers
Using RegisterClientScriptBlock I have no problem whith displaying the warning alert but after I close the pop up the binding becomes a real mess. The weird thing is that when I try to debug it and go with F10 the binding is ok.
This this a code behind method:
protected void lvContratFonds_OnItemDeleting(object source, ListViewDeleteEventArgs e)
{
try
{
ListView lv = (ListView)source;
int contratId = int.Parse(((HiddenField)lv.Parent.FindControl("hdnContratId")).Value);
int anneeFiscaleId = int.Parse(((HiddenField)lv.Items[e.ItemIndex].FindControl("hdnAnneeFiscaleId")).Value);
int contratFondId = int.Parse(((HiddenField)lv.Items[e.ItemIndex].FindControl("hdnContratFondId")).Value);
ImageButton lnkSupprimerContratFonds = (ImageButton)lv.Items[e.ItemIndex].FindControl("lnkSupprimerContratFonds");
string errMsg = String.Empty;
errMsg = ContratFondBLL.DeleteSingleContratFond(contratFondId, ((PageProjet)Page).ProjetId);
if (errMsg.Length == 0)
{
ContratsFondsTransBLL.DeleteAllContratFondTransByContratId(contratFondId, ((PageProjet)Page).ProjetId);
}
else
{
ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "ClientScript", "alert('" + Resources.GPWebResource.errContratFondDelete.ToString() + "')", true);
}
bindContrats();
}
catch(Exception ex)
{
throw (ex);
}
}
<LayoutTemplate>
<div class="wideContainer">
<asp:Literal ID="ltlOrphanWarning" runat="server" Text="OrphanWarning"></asp:Literal>
<asp:PlaceHolder runat="server" ID="itemPlaceHolder" />
<div class="contentDiv">
<asp:LinkButton CssClass="showbtn" ID="btnAjoutContrat" runat="server" Text="AjouterContratAddContract" OnClick="btnAjouterContrat_Click" Visible="false" />
</div>
</div>
</LayoutTemplate>
<ItemTemplate>
<div class="wideContainer">
<div class="contentDiv">
<asp:HiddenField ID="hdnContratId" runat="server" Value='("ContratId") ' />
<div class="titleCellContrats smallCell"><asp:literal ID="ltlContratNum" runat="server" Text="ContratNum"/></div>
<div class="titleCellContrats largeCell"><asp:literal ID="ltlType" runat="server" Text="Type"/></div>
<div class="titleCellContrats mediumCell"><asp:literal ID="ltlDateDND8" runat="server" Text="DateDND8"/></div>
<div class="titleCellContrats mediumCell"><asp:literal ID="ltlDtOctroi" runat="server" Text="ApprovalDateOctroi"/></div>
<div class="titleCellContrats mediumCell"><asp:literal ID="ltlFundsTot" runat="server" Text="ValContratTotal"/></div>
<div class="modCellTitle"> </div>
</div>
<div class="contentDiv">
<div class="contentCellContrats smallCell"><asp:Literal ID="numeroContrat" runat="server"/></div>
<div class="contentCellContrats largeCell boldText"><asp:Literal ID="typeContrat" runat="server" /></div>
<div class="contentCellContrats mediumCell"><asp:Literal ID="dateDND8" runat="server" /></div>
<div class="contentCellContrats mediumCell">
<asp:Literal ID="dateOctroi" runat="server"/>
<asp:CheckBox ID="chkbxOctroi" runat="server" AutoPostBack="false" Enabled="false" />
</div>
<div class="contentCellContrats mediumCell"><asp:Literal ID="ltlTotal" runat="server"/></div>
<div class="modCellContrats">
<asp:ImageButton ID="btnModifierContrat" runat="server" Tooltip="ModifierModify" ImageUrl="~/WebUI/images/icones/edit_16x16.gif" CommandName="Edit" Visible="false" />
<asp:ImageButton ID="btnDeleteContrat" runat="server" Tooltip="Supprimer" ImageUrl="~/WebUI/images/icones/delete_16x16.gif" CommandName="Delete" OnClientClick="SuppContratDeleteContract" Visible="false"/>
</div>
</div>
<div class="contentDiv">
<asp:Literal ID="ltlCommentaires" runat="server"/>
</div>
<div class="contentDiv">
<div class="titleCellContrats Fonds">
<div class="alLeft"><asp:literal ID="ltlfunds" runat="server" Text="ValContrat"/></div>
<div class="alRight smText"><asp:LinkButton ID="lnkAjouterContratFond" runat="server" Text="AjoutEF" OnClick="lnkAjouterContratFond_Click" Visible="false"/></div>
</div>
<asp:ListView
ID="lvContratFonds" runat="server"
InsertItemPosition="None"
OnItemDataBound="lvContratFonds_OnItemDataBound"
ItemPlaceholderID="afficherFonds"
OnItemEditing="lvContratFonds_OnItemEditing"
OnItemUpdating="lvContratFonds_OnItemUpdating"
OnItemCanceling="lvContratFonds_OnItemCanceling"
OnItemDeleting="lvContratFonds_OnItemDeleting"
OnItemInserting="lvContratFonds_OnItemInserting"
OnItemCreated="lvContratFonds_OnItemCreated" >
<LayoutTemplate>
<asp:PlaceHolder runat="server" ID="afficherFonds" />
</LayoutTemplate>
<ItemTemplate>
<div class="contentDiv">
<div class="contFondsRows">
<div class="contentCellContrats ContFonds"><asp:Literal ID="lblAnneeFiscaleEF" runat="server" /></div>
<div class="contentCellContrats ContFonds"><asp:Literal ID="lblFondsContrat" runat="server" /></div>
<div class="contentCellContrats ContFonds">
<strong><asp:Literal ID="ltlDeltaTitle" runat="server" Text="Delta" />:</strong>
<asp:Literal ID="ltlContratFondDelta" runat="server" />
</div>
<div class="modCellCntrFonds">
<asp:ImageButton class="smText" ID="btnModifierContratFonds" runat="server" Tooltip="ModifierModify" ImageUrl="~/WebUI/images/icones/edit_16x16.gif" Height="10" Width="10" CommandName="Edit" Visible="false" />
<asp:ImageButton
class="smText"
ID="lnkSupprimerContratFonds"
runat="server"
Tooltip="Supprimer"
ImageUrl="~/WebUI/images/icones/delete_16x16.gif"
Height="10"
Width="10"
CommandName="Delete"
OnClientClick="SuppFondsDeleteFunds"
Visible="false"/>
<asp:HiddenField ID="hdnContratFondId" runat="server" Value='("ContratFondId") ' />
<asp:HiddenField ID="hdnContratId" runat="server" Value='("ContratId") ' />
<asp:HiddenField ID="hdnAnneeFiscaleId" runat="server" Value='("AnneeFiscaleId") ' />
<asp:HiddenField ID="hdnEF" runat="server" Value='("efID") ' />
</div>
</div>
</div>
</ItemTemplate>
<EditItemTemplate>
<div class="contentDiv">
<asp:HiddenField ID="hdnEditTemplate" runat="server" Value='True' />
<div class="contFondsRows">
<div class="contentCellContrats ContFonds"><asp:DropDownList ID="ddlEF_AF_Prog" runat="server" DataTextField="DisplayField" DataValueField="EF_ID" OnSelectedIndexChanged="ddlEF_Changed" AutoPostBack="true" AppendDataBoundItems="false"></asp:DropDownList></div>
<div class="contentCellContrats ContFonds"><asp:TextBox ID="txtFondsContrat" runat="server"></asp:TextBox> $</div>
<div class="contentCellContrats ContFonds">
<strong><asp:Literal ID="ltlDeltaTitle" runat="server" Text="Delta" />:</strong>
<asp:Literal ID="ltlContratFondDelta" runat="server" />
</div>
<div class="modCellCntrFonds">
<asp:ImageButton
class="smText"
ID="btnEnregistrerContratFonds"
runat="server"
Tooltip="EnregistrerRegister"
ImageUrl="~/WebUI/images/icones/save_16x16.gif"
Height="12"
Width="12"
CommandName="Update" />
<asp:ImageButton class="smText" ID="btnAnnulerContratFonds" runat="server" Tooltip="Cancel" ImageUrl="~/WebUI/images/icones/undo1_16x16.gif" Height="12" Width="12" CommandName="Cancel" CausesValidation="false"/>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="FondMontantObligAmntReqd" Display="Dynamic" ControlToValidate="txtFondsContrat" />
<asp:CompareValidator id="CheckFormat1" runat="server" ControlToValidate="txtFondsContrat" Operator="DataTypeCheck" Type="Currency" Display="Dynamic" ErrorMessage="InvalidCurrency" />
<asp:HiddenField ID="hdnContratFondId" runat="server" Value='("ContratFondId") ' />
<asp:HiddenField ID="hdnContratId" runat="server" Value='("ContratId") ' />
<asp:HiddenField ID="hdnAnneeFiscaleId" runat="server" Value='("AnneeFiscaleId") ' />
<asp:HiddenField ID="hdnEF" runat="server" Value='("efID") ' />
</div>
</div>
</div>
<div id="transPanel" class="contentDiv" runat="server">
<asp:UpdatePanel ID="updPnlTransactions" runat="server">
<ContentTemplate>
<uc2:FMASTransControl ID="uc2FMASTransControl" runat="server" ContratMode="true" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</EditItemTemplate>
<InsertItemTemplate>
<div class="contentDiv">
<div class="contFondsRows">
<div class="contentCellContrats ContFonds"><asp:DropDownList ID="ddlEF_AF_Prog" runat="server" DataTextField="DisplayField" DataValueField="EF_ID" AutoPostBack="true" AppendDataBoundItems="false"></asp:DropDownList></div>
<div class="contentCellContrats ContFonds"><asp:TextBox ID="txtFondsContrat" runat="server"></asp:TextBox> $</div>
<div class="contentCellContrats ContFonds">
<strong><asp:Literal ID="ltlDeltaTitle" runat="server" Text="Delta" />:</strong>
<asp:Literal ID="ltlContratFondDelta" runat="server" Text="AD_InfoNA" />
</div>
<div class="modCellCntrFonds">
<asp:ImageButton ID="btnAjouterCF" runat="server" ClientIDMode="Static" Tooltip="EnregistrerRegister" ImageUrl="~/WebUI/images/icones/save_16x16.gif" Height="12" Width="12" CommandName="Insert" ValidationGroup="insertFondGroup"/>
<asp:ImageButton ID="btnAnnulerCF" runat="server" Tooltip="Cancel" ImageUrl="~/WebUI/images/icones/undo1_16x16.gif" Height="12" Width="12" OnClick="btnAnnulerCF_Click" CausesValidation="false" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="FondMontantObligAmntReqd" Display="Dynamic" ControlToValidate="txtFondsContrat" ValidationGroup="insertFondGroup" />
<asp:CompareValidator id="CheckFormat1" runat="server" ControlToValidate="txtFondsContrat" Operator="DataTypeCheck" Type="Currency" Display="Dynamic" ErrorMessage="InvalidCurrency" />
<asp:HiddenField ID="hdnContratId" runat="server" Value='("ContratId") ' />
</div>
</div>
</div>
</InsertItemTemplate>
</asp:ListView>
</div>
<div class="contentDiv"> </div>
</div>
</ItemTemplate>
<EditItemTemplate>
<div class="wideContainer">
<asp:HiddenField ID="hdnContratId" runat="server" Value='("ContratId") ' />
<asp:HiddenField ID="hdnEditTemplate" runat="server" Value='True' />
<div class="contentDiv">
<div class="titleCellContrats smallCell"><asp:literal ID="ltlContratNum" runat="server" Text="ContratNum"/></div>
<div class="titleCellContrats largeCell"><asp:literal ID="ltlType" runat="server" Text="Type"/></div>
<div class="titleCellContrats mediumCell"><asp:literal ID="ltlDateDND8" runat="server" Text="DateDND8"/></div>
<div class="titleCellContrats mediumCell"><asp:literal ID="ltlDtOctroi" runat="server" Text="ApprovalDateOctroi"/></div>
<div class="titleCellContrats mediumCell"><asp:literal ID="ltlFundsTot" runat="server" Text="Delta"/></div>
<div class="modCellTitle"> </div>
</div>
<div class="contentDiv">
<div class="contentCellContrats smallCell"><asp:TextBox ID="txtContrat" runat="server" MaxLength="8"></asp:TextBox></div>
<div class="contentCellContrats largeCell">
<asp:DropDownList ID="ddlTypeContrat" runat="server" DataTextField="NomChampFieldNm" DataValueField="TypeContratId"></asp:DropDownList>
</div>
<div class="contentCellContrats mediumCell"><uc1:DateControl ID="dateDND8" runat="server" /></div>
<div class="contentCellContrats mediumCell">
<uc1:DateControl ID="dateOctroi" runat="server"/>
<asp:CompareValidator ID="cmpOctroiAfterDND8" runat="server" ControlToCompare="dateDND8$txtDate" ControlToValidate="dateOctroi$txtDate"
ErrorMessage="ErrDateOctroi " Type="Date" Operator="GreaterThanEqual" ToolTip="ErrEndDate ">*</asp:CompareValidator>
<asp:CheckBox ID="chkbxOctroi" runat="server" AutoPostBack="false" onclick="GetTodayDateForOctroi();" />
</div>
<div class="contentCellContrats mediumCell"><asp:Literal ID="ltlTotal" runat="server" Text="" /></div>
<div class="modCellContrats">
<asp:ImageButton ID="btnEnregistrerContrat" runat="server" Tooltip="EnregistrerRegister" ImageUrl="~/WebUI/images/icones/save_16x16.gif" CommandArgument='("ContratId") ' CommandName="Update" />
<asp:ImageButton ID="btnAnnulerContrat" runat="server" Tooltip="Cancel" ImageUrl="~/WebUI/images/icones/undo1_16x16.gif" CommandArgument='("ContratId") ' CommandName="Cancel" />
</div>
</div>
<div class="contentDiv paleBackground <%# Container.DisplayIndex % 2 == 0 ? "" : "altRow" bordered">
<asp:TextBox ID="txtCommentairesContrats" runat="server" Width="100%" MaxLength="250"></asp:TextBox>
<ajx:TextBoxWatermarkExtender ID="tbweCommentairesContrats" runat="server" TargetControlID="txtCommentairesContrats" WatermarkText=" tbweCommentContats" WatermarkCssClass="watermarked" />
</div>
<div class="contentDiv">
<div class="titleCellContrats Fonds">
<div class="alLeft"><asp:literal ID="ltlfunds" runat="server" Text="ValContrat"/></div>
<div class="alRight"><asp:LinkButton class="smText" ID="lnkAjouterContratFond" runat="server" Text="<%$Resources:GPWebResource,AjoutEF" OnClick="lnkAjouterContratFond_Click" Visible="false"/></div>
</div>
<asp:ListView
ID="lvContratFonds"
runat="server"
InsertItemPosition="None"
OnItemDataBound="lvContratFonds_OnItemDataBound"
ItemPlaceholderID="afficherFonds2"
OnItemEditing="lvContratFonds_OnItemEditing"
OnItemUpdating="lvContratFonds_OnItemUpdating"
OnItemCanceling="lvContratFonds_OnItemCanceling"
OnItemDeleting="lvContratFonds_OnItemDeleting"
OnItemInserting="lvContratFonds_OnItemInserting"
OnItemCreated="lvContratFonds_OnItemCreated" >
<LayoutTemplate>
<asp:PlaceHolder runat="server" ID="afficherFonds2" />
</LayoutTemplate>
<ItemTemplate>
<div class="contentDiv">
<div class="contFondsRows">
<div class="contentCellContrats ContFonds"><asp:Literal ID="lblAnneeFiscaleEF" runat="server" /></div>
<div class="contentCellContrats ContFonds"><asp:Literal ID="lblFondsContrat" runat="server" /></div>
<div class="contentCellContrats ContFonds">
<strong><asp:Literal ID="ltlDeltaTitle" runat="server" Text="Delta" />:</strong>
<asp:Literal ID="ltlContratFondDelta" runat="server" />
</div>
<div class="modCellCntrFonds">
<asp:ImageButton class="smText" ID="btnModifierContratFonds" runat="server" Tooltip="ModifierModify" ImageUrl="~/WebUI/images/icones/edit_16x16.gif" Height="10" Width="10" CommandName="Edit" Visible="false" />
<asp:ImageButton class="smText" ID="lnkSupprimerContratFonds" runat="server" Tooltip="Supprimer"
ImageUrl="~/WebUI/images/icones/delete_16x16.gif" Height="10" Width="10" CommandName="Delete"
OnClientClick="SuppFondsDeleteFunds" Visible="false"/>
<asp:HiddenField ID="hdnContratFondId" runat="server" Value='("ContratFondId") ' />
<asp:HiddenField ID="hdnContratId" runat="server" Value='("ContratId") ' />
<asp:HiddenField ID="hdnAnneeFiscaleId" runat="server" Value='("AnneeFiscaleId") ' />
<asp:HiddenField ID="hdnEF" runat="server" Value='("efID") ' />
</div>
</div>
</div>
</ItemTemplate>
</asp:ListView>
</div>
<div class="contentDiv"> </div>
</div>
</EditItemTemplate>
<InsertItemTemplate>
<div class="wideContainer">
<asp:HiddenField ID="hdnContratId" runat="server" Value='("ContratId") ' />
<asp:HiddenField ID="hdnEditTemplate" runat="server" Value='True' />
<div class="contentDiv">
<div class="titleCellContrats smallCell"><asp:literal ID="ltlContratNum" runat="server" Text="ContratNum"/></div>
<div class="titleCellContrats largeCell"><asp:literal ID="ltlType" runat="server" Text="Type"/></div>
<div class="titleCellContrats mediumCell"><asp:literal ID="ltlDateDND8" runat="server" Text="DateDND8"/></div>
<div class="titleCellContrats mediumCell"><asp:literal ID="ltlDtOctroi" runat="server" Text="ApprovalDateOctroi"/></div>
<div class="titleCellContrats mediumCell"><asp:literal ID="ltlFundsTot" runat="server" Text="Delta"/></div>
<div class="modCellTitle"> </div>
</div>
<div class="contentDiv <%# Container.DisplayIndex % 2 == 0 ? "" : "altRow" ">
<div class="contentCellContrats smallCell"><asp:TextBox ID="txtContrat" runat="server" MaxLength="8"></asp:TextBox></div>
<div class="contentCellContrats largeCell">
<asp:DropDownList ID="ddlTypeContrat" runat="server" DataTextField="NomChampFieldNm" DataValueField="TypeContratId"></asp:DropDownList>
</div>
<div class="contentCellContrats mediumCell"><uc1:DateControl ID="dateDND8" runat="server" /></div>
<div class="contentCellContrats mediumCell">
<uc1:DateControl ID="dateOctroi" runat="server" />
<asp:CompareValidator ID="cmpOctroiAfterDND8" runat="server" ControlToCompare="dateDND8$txtDate" ControlToValidate="dateOctroi$txtDate"
ErrorMessage="ErrDateOctroi " Type="Date" Operator="GreaterThanEqual" ToolTip="ErrEndDate ">*</asp:CompareValidator>
</div>
<div class="contentCellContrats mediumCell"><asp:Literal ID="ltlTotal" runat="server" Text="" /></div>
<div class="modCellContrats">
<asp:ImageButton ID="btnAjouterContrat" runat="server" Tooltip="Add " ImageUrl="~/WebUI/images/icones/add_16x16.gif" CommandName="Insert" />
<asp:ImageButton ID="btnAnnulerContrat" runat="server" Tooltip="Cancel" ImageUrl="~/WebUI/images/icones/undo1_16x16.gif" CausesValidation="false" OnClick="btnAnnulerAjouterContrat_Click"/>
</div>
</div>
<div class="contentDiv bordered">
<asp:TextBox ID="txtCommentairesContrats" runat="server" Width="100%" MaxLength="250"></asp:TextBox>
<ajx:TextBoxWatermarkExtender ID="tbweCommentairesContrats" runat="server" TargetControlID="txtCommentairesContrats" WatermarkText="tbweCommentContats" WatermarkCssClass="watermarked" />
</div>
</div>
</InsertItemTemplate>
can you please explain what you mean by "the binding becomes a real mess"? Do you get duplicates?
Also, are you able to post the code for your bindContrats() method?
Edit 1:
ScriptManager.RegisterClientScriptBlock(lvContratFonds, typeof(ListView), "ClientScript", "alert('" + Resources.GPWebResource.errContratFondDelete.ToString() + "')", true);
Edit 2:
if (errMsg.Length == 0)
{
ContratsFondsTransBLL.DeleteAllContratFondTransByContratId(contratFondId, ((PageProjet)Page).ProjetId);
bindContrats(); // re-bind data
}
else
{
e.Cancel = true;
ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "ClientScript", "alert('" + Resources.GPWebResource.errContratFondDelete.ToString() + "')", true);
/* don't re-bind! */
}
i've used a DataList (dlparent) control for one of my page. Inside that datalist is another Datalist (dlchild) that is being populated by itemdatabound event of the parent datalist. i've used css with dlchild.
Databinding is ok and the required output shows great with mozilla and IE but not in netscape, safari and google chrome. dlchild is not showing. only item in dlparent appears.
Here's the markup for the dlparent:
<asp:DataList ID="SprintsWorkData" Style="float: left; padding-top: 10px;" runat="server"
OnItemDataBound="SprintsWorkData_ItemDataBound">
<ItemTemplate>
<asp:HiddenField ID="hiddenSprintId" runat="server" Value='<%# Eval("SprintId") %>' />
<div id="SprintNameSection">
<h4>
<%# Eval("SprintName") %></h4>
</div>
<div id="HeaderSection_SelectAll">
<div style="padding-top: 3px; height: 23px; padding-left: 2px;">
<asp:CheckBox ID="isAllCheck" runat="server" onclick="checkAll(this)" />
<b>
<asp:Label ID="sAll" Style="color: Black; text-indent: 1px;" Text="Select All" runat="server"></asp:Label>
</b>
</div>
</div>
<div class="HeaderSection_WorkedHours">
<b><asp:Literal ID="workedHours" runat="server" Text='<%$ Resources:LanguagePack, Worked_Hours %>'></asp:Literal></b></div>
<div class="HeaderSection_BillableHours">
<b><asp:Literal ID="billableHours" runat="server" Text='<%$ Resources:LanguagePack, Billable_Hours %>'></asp:Literal></b></div>
<div class="HeaderSection_Comments">
<b><asp:Literal ID="comments" runat="server" Text='<%$ Resources:LanguagePack, Comments %>'></asp:Literal></b></div>
<asp:DataList ID="HoursWorkData" runat="server">
<ItemTemplate>
<asp:HiddenField ID="hiddenTaskId" runat="server" Value='<%# Eval("BacklogId") %>' />
<div id="ItemSection_Task_Header">
<div style="vertical-align: middle; padding-bottom: 2px; padding-left: 2px; height: 18px;">
<asp:CheckBox ID="checkboxSub" runat="server" onclick="checkAllSub(this)" />
<b style="text-indent: 1px;">
<%# Eval("Title") %></b>
</div>
</div>
<div id="ItemSection_WorkedHours_Header">
<%# Eval("WorkedHours")%> </div>
<div id="ItemSection_BillableHours_Header">
<asp:Label ID="lblBillableHours_Header" Text='<%# Eval("BillableHours")%>' runat="server"></asp:Label> </div>
<div id="ItemSection_Comments_Header">
</div>
<asp:Repeater ID="repResourcesList" runat="server">
<ItemTemplate>
<asp:HiddenField ID="hiddenReportId1" runat="server" Value='<%# Eval("ReportId") %>' />
<div id="ItemSection_Task_Item">
<div style="vertical-align: middle; padding-bottom: 5px; padding-left: 2px; padding-top: 1px;
height: 14px;">
<asp:CheckBox ID="CB" runat="server" onclick="checkItem(this)" />
<b style="text-indent: 1px;">
<%# Eval("EnteredbyName") %></b>
</div>
</div>
<div id="ItemSection_WorkedHours_Item">
<asp:Label ID="lblWorkedHours_Item" Text='<%# Eval("WorkedHours")%>' runat="server"></asp:Label> </div>
<div id="ItemSection_BillableHours_Item">
<asp:RegularExpressionValidator ValidationGroup="ApproveBillable" ID="RegularExpressionValidator1"
runat="server" ErrorMessage="*" ValidationExpression="^(-)?\d+(\.\d\d)?$" ControlToValidate="txtBillableHours"
Style="position: absolute;">*</asp:RegularExpressionValidator>
<asp:TextBox ID="txtBillableHours" Style="text-align: right" runat="server" Font-Size="12px"
Width="50px" Text='<%# Eval("BillableHours") %>'></asp:TextBox>
</div>
<div id="ItemSection_Comments_Item">
<asp:TextBox ID="txtComments" Font-Size="12px" Width="93px" runat="server" Text='<%# Eval("Comment") %>'></asp:TextBox>
</div>
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
<ItemStyle Height="24px" />
<SeparatorTemplate>
<div id="divSeparator">
</div>
</SeparatorTemplate>
<FooterTemplate>
<div id="Footer1">
TOTAL HOURS
</div>
<div id="Footer_WorkedHours">
<asp:Label ID="lblWorkedHours" runat="server" Text="0.00" Font-Size="12px" ForeColor="White"></asp:Label>
</div>
<div id="Footer_BillableHours">
<asp:Label ID="lblBillableHours_Footer" runat="server" Text="0.00" Font-Size="12px"
ForeColor="White"></asp:Label>
</div>
<div id="Footer_Comments">
</div>
</FooterTemplate>
</asp:DataList>
</ItemTemplate>
<SeparatorTemplate>
</SeparatorTemplate>
</asp:DataList>
What might be the problem?
<asp:DataList ID="SprintsWorkData" Style="float: left; padding-top: 1px;" runat="server"
OnItemDataBound="SprintsWorkData_ItemDataBound">
<ItemTemplate>
<asp:HiddenField ID="hiddenSprintId" runat="server" Value='<%# Eval("SprintId") %>' />
<div id="SprintNameSection">
<h4>
<%# Eval("SprintName") %></h4>
</div>
<div id="HeaderSection_SelectAll">
<div style="padding-top: 3px; height: 23px; padding-left: 2px;">
<asp:CheckBox ID="isAllCheck" runat="server" onclick="checkAll(this)" />
<b>
<asp:Label ID="sAll" Style="color: Black; text-indent: 1px;" Text="Select All" runat="server"></asp:Label>
</b>
</div>
</div>
<div class="HeaderSection_WorkedHours">
<b>
<asp:Literal ID="workedHours" runat="server" Text='<%$ Resources:LanguagePack, Worked_Hours %>'></asp:Literal></b></div>
<div class="HeaderSection_BillableHours">
<b>
<asp:Literal ID="billableHours" runat="server" Text='<%$ Resources:LanguagePack, Billable_Hours %>'></asp:Literal></b></div>
<div class="HeaderSection_Comments">
<b>
<asp:Literal ID="comments" runat="server" Text='<%$ Resources:LanguagePack, Comments %>'></asp:Literal></b></div>
<asp:DataList ID="HoursWorkData" runat="server" Style="float: left;">
<ItemTemplate>
<asp:HiddenField ID="hiddenTaskId" runat="server" Value='<%# Eval("BacklogId") %>' />
<div id="ItemSection_Task_Header">
<div style="vertical-align: middle; padding-bottom: 2px; padding-left: 2px; height: 18px;">
<asp:CheckBox ID="checkboxSub" runat="server" onclick="checkAllSub(this)" />
<b style="text-indent: 1px;">
<%# Eval("Title") %></b>
</div>
</div>
<div id="ItemSection_WorkedHours_Header">
<%# Eval("WorkedHours")%> </div>
<div id="ItemSection_BillableHours_Header">
<asp:Label ID="lblBillableHours_Header" Text='<%# Eval("BillableHours")%>' runat="server"></asp:Label> </div>
<div id="ItemSection_Comments_Header">
</div>
<asp:Repeater ID="repResourcesList" runat="server">
<ItemTemplate>
<asp:HiddenField ID="hiddenReportId1" runat="server" Value='<%# Eval("ReportId") %>' />
<div id="ItemSection_Task_Item">
<div style="vertical-align: middle; padding-bottom: 5px; padding-left: 2px; padding-top: 1px;
height: 14px;">
<asp:CheckBox ID="CB" runat="server" onclick="checkItem(this)" />
<b style="text-indent: 1px;">
<%# Eval("EnteredbyName") %></b>
</div>
</div>
<div id="ItemSection_WorkedHours_Item">
<asp:Label ID="lblWorkedHours_Item" Text='<%# Eval("WorkedHours")%>' runat="server"></asp:Label> </div>
<div id="ItemSection_BillableHours_Item">
<asp:RegularExpressionValidator ValidationGroup="ApproveBillable" ID="RegularExpressionValidator1"
runat="server" ErrorMessage="*" ValidationExpression="^(-)?\d+(\.\d\d)?$" ControlToValidate="txtBillableHours"
Style="position: absolute;">*</asp:RegularExpressionValidator>
<asp:TextBox ID="txtBillableHours" Style="text-align: right" runat="server" Font-Size="12px"
Width="50px" Text='<%# Eval("BillableHours") %>'></asp:TextBox>
</div>
<div id="ItemSection_Comments_Item">
<asp:TextBox ID="txtComments" Font-Size="12px" Width="93px" runat="server" Text='<%# Eval("Comment") %>'></asp:TextBox>
</div>
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
<ItemStyle Height="24px" />
<SeparatorTemplate>
<div id="divSeparator">
</div>
</SeparatorTemplate>
<FooterTemplate>
<div id="Footer1">
<asp:Literal ID="totalHours" runat="server" Text='<%$ Resources:LanguagePack,TOTAL_HOURS %>'></asp:Literal>
</div>
<div id="Footer_WorkedHours">
<asp:Label ID="lblWorkedHours" runat="server" Text="0.00" Font-Size="12px" ForeColor="White"></asp:Label>
</div>
<div id="Footer_BillableHours">
<asp:Label ID="lblBillableHours_Footer" runat="server" Text="0.00" Font-Size="12px"
ForeColor="White"></asp:Label>
</div>
<div id="Footer_Comments">
</div>
</FooterTemplate>
</asp:DataList>
</ItemTemplate>
<SeparatorTemplate>
</SeparatorTemplate>
</asp:DataList>
I've just forgot to add float:left to the inner datalist or dlchild. the parent datalist has float:left