I have a formview that binds to an Entity Framework datasource using the following code:
Private Sub LoadFormviewData()
Dim ctx As New SNOTEntities
Dim RepCalls = ctx.SNOT_RepCall_view
Dim strSQL As New StringBuilder
strSQL.Append("select * from SNOT_RepCall_view where DateInput >= '")
strSQL.Append(Startdate.ToShortDateString)
strSQL.Append("' and DateInput <= '")
strSQL.Append(EndDate.ToShortDateString)
If IncReviewed = "N" Then
strSQL.Append("' and Reviewed = 'N'")
Else
strSQL.Append("'")
End If
strSQL.Append(" order by IssueID")
Dim calls = RepCalls.SqlQuery(strSQL.ToString)
FormView1.DataSource = calls.ToList
FormView1.DataBind()
If 1 = 1 Then
End If
End Sub
Using the AllowPaging=true I find that it skips every other record when paging. I am new to EF and not that good at ASP.net so forgive me if you require any more info.
I use the IndexChanging and Indexchanged events to save/populate fields that are outside of the formview (too much code to post unless requested)
I have confirmed that the correct amount of records are in 'calls' and that they make it into the Formview datasource. It just skips every other record when paging. Have stared at this code for days. Any help/suggestions welcome.
Formview markup:
<asp:FormView ID="FormView1" runat="server" Height="521px" Width="375px" HorizontalAlign="Left" AllowPaging="True">
<ItemTemplate>
<asp:label ID="HiddenField1" runat="server" Text='<%#Eval("IssueID")%>'/>
<asp:Label ID="Label12" runat="server" Text="<%# FormView1.PageIndex%>"></asp:Label>
<table border="1" style="width: 375px; ">
<tr>
<td><asp:Label ID="Label3" runat="server" CssClass="LabelBold" Text="Call Date:"></asp:Label>
<asp:Label ID="lblCallDate" runat="server" CssClass="LabelNormal" Text='<%#Eval("CallDate", "{0:dd/M/yyyy}")%>'></asp:Label>
</td>
<td> </td>
</tr>
<tr>
<td>
<asp:Label ID="Label5" runat="server" CssClass="LabelBold" Text='Input Date:'></asp:Label>
<asp:Label ID="lblInputDate" runat="server" CssClass="LabelNormal" Text='<%#Eval("DateInput", "{0:dd/M/yyyy}")%>'></asp:Label>
</td>
<td>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label11" runat="server" CssClass="LabelBold" Text='<%#Eval("IssueTypeName")%>'></asp:Label>
</td>
<td>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblStore" runat="server" CssClass="LabelBold" Text='<%#Eval("StoreName")%>'></asp:Label>
</td>
<td>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label6" runat="server" CssClass="LabelBold" Text="Rep:"></asp:Label>
<asp:Label ID="lblRep" runat="server" CssClass="LabelNormal" Text='<%#Eval("InputByName")%>'></asp:Label>
</td>
<td> </td>
</tr>
<tr>
<td>
<asp:Label ID="lblCust" runat="server" CssClass="LabelBold" Text='<%#Eval("CustName")%>'></asp:Label>
</td>
<td> </td>
</tr>
<tr>
<td>
<asp:Label ID="Label1" runat="server" CssClass="LabelBold" Text="Vendor:"></asp:Label>
<asp:Label ID="lblVendor" runat="server" CssClass="LabelNormal" Text='<%#Eval("Vendor")%>'></asp:Label>
</td>
<td> </td>
</tr>
<tr>
<td>
<asp:Label ID="Label2" runat="server" CssClass="LabelBold" Text="Rep Notes:"></asp:Label>
<br />
<asp:Label ID="lblDetails" runat="server" CssClass="LabelNormal" Text='<%#Eval("Details")%>'></asp:Label>
</td>
<td> </td>
</tr>
<tr>
<td>
<asp:Label ID="Label4" runat="server" CssClass="LabelBold" Text="Reviewer Notes:"></asp:Label>
<br />
<asp:TextBox ID="txtRevNotes" runat="server" Height="130px" TextMode="MultiLine" Width="345px" Text='<%#Eval("ReviewerNotes")%>' ReadOnly="True"></asp:TextBox>
</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
</ItemTemplate>
<EmptyDataTemplate>
There is nothing to see here.
</EmptyDataTemplate>
<PagerSettings Position="TopAndBottom" Mode="NumericFirstLast" />
<%-- <PagerTemplate>
<table style="border: thin solid #000000; width: 375px;">
<tr>
<td style="width: 80px" >
<%-- <asp:linkButton
id="lnkPrevious"
Text="Prev"
CommandName="Page"
CommandArgument="Prev"
Runat="server" />
</td>
<td style="font-family: Arial, Helvetica, sans-serif; text-align: center; width: 215px">
<asp:Label ID="Label8" runat="server" Text="<%# FormView1.PageCount - FormView1.PageIndex -1%>"></asp:Label>
more to go
</td>
<td style="width: 80px">
<asp:linkButton
id="lnkNext"
Text="Next"
CommandName="Page"
CommandArgument="Next"
Runat="server" />
</td>
</tr>
</table>
</PagerTemplate>--%>
</asp:FormView>
The pagertemplate is commented out as part of my testing leaving just the default version.
Related
I am currently trying to ' Loop ' through my DataGrid to check if the boxes that are ticked to be shown on another page that pretty much looks like my existing one.
I'm having trouble finding out how to actually do a ' loop ' as they are called I think as I am a slow learner in coding , am just looking for some guidance in how I would achieve this goal of actually getting a handle on the Data. Below is my code for the ASP.GridView & well there is no VB.NET code-behind as of such because well , am stuck & need pushing the right direction .
EDIT: Forgot to mention , why cant I do this from a Dim This As String?
<asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource1" Width="100%">
<HeaderTemplate>
<table width="100%" style="font-family: Verdana; font-size: 8pt" cellpadding="0"
cellspacing="0" border="1">
<tr align="left">
<th colspan="4">
Customer:
<asp:Label ID="Customer_lab" runat="server"></asp:Label>
</th>
<th colspan="4">
Quote:
<asp:Label ID="Quote_lab" runat="server"></asp:Label>
</th>
<th colspan="4">
Project:
<asp:Label ID="Project_lab" runat="server"></asp:Label></th>
</tr>
<tr>
<th></th>
<th>
CODE
</th>
<th>
DESCRIPTION
</th>
<th>
LENGTH
</th>
<th>
WIDTH
</th>
<th>
QTY
</th>
<th>
COST
</th>
<th>
£M2
</th>
<th>
£UNIT
</th>
<th>
SUPPLIER</th>
<th>
QTY</th>
<th>
DUE DATE</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<asp:CheckBox ID="ChkItem" runat="server" /></td>
<td style="width: 150px">
<asp:Label ID="Label1" runat="server" Text='<%# Eval("Code") %>'></asp:Label></td>
<td>
<asp:Label ID="Label2" runat="server" Text='<%# Eval("Description") %>'></asp:Label></td>
<td align="right">
<asp:Label ID="Label5" runat="server" Text='<%# Eval("Length") %>'></asp:Label></td>
<td align="right">
<asp:Label ID="Label6" runat="server" Text='<%# Eval("Width") %>'></asp:Label></td>
<td align="center">
<asp:Label ID="Label3" runat="server" Text='<%# Eval("Qty") %>'></asp:Label></td>
<td align="right">
<asp:Label ID="Label4" runat="server" Text='<%# Eval("Cost") %>'></asp:Label></td>
<td align="right">
<asp:Label ID="Label7" runat="server" Text='<%# Eval("M2") %>'></asp:Label></td>
<td align="right">
<asp:Label ID="Label8" runat="server" Text='<%# Eval("SHT") %>'></asp:Label></td>
<td>
<asp:DropDownList ID="DD1" Width="100%" runat="server" Font-Names="Verdana" Font-Size="8pt">
</asp:DropDownList></td>
<td align="left">
<asp:TextBox ID="Qty_Txt1" OnTextChanged="GetData" OnDataBinding='<%# Eval("Code") %>'
AutoPostBack="true" Width="80%" Font-Names="Verdana" Font-Size="8pt" runat="server"></asp:TextBox></td>
<td>
<asp:TextBox ID="Date1" Width="90%" Font-Names="Verdana" Font-Size="8pt" AutoPostBack="true" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td></td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td align="center">
<b>
<asp:Label ID="New_Lab" Font-Size="8pt" runat="Server"></asp:Label></b></td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
<asp:DropDownList ID="DD2" Width="100%" Font-Names="Verdana" Font-Size="8pt" runat="server">
</asp:DropDownList></td>
<td align="left">
<asp:TextBox ID="Qty_Txt2" AutoPostBack="true" Width="80%" Font-Names="Verdana"
Font-Size="8pt" runat="Server"></asp:TextBox></td>
<td>
<asp:TextBox ID="Date2" Width="90%" Font-Names="Verdana" Font-Size="8pt" runat="Server"></asp:TextBox></td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
<asp:DropDownList ID="DD3" Width="100%" Font-Names="Verdana" Font-Size="8pt" runat="server">
</asp:DropDownList></td>
<td align="left">
<asp:TextBox ID="Qty_Txt3" AutoPostBack="true" Width="80%" Font-Names="Verdana"
Font-Size="8pt" runat="Server"></asp:TextBox></td>
<td width="8%">
<asp:TextBox ID="Date3" Width="90%" Font-Names="Verdana" Font-Size="8pt" runat="Server" ValidationGroup="PersonalInfoGroup">
</asp:TextBox>
<asp:CustomValidator id="RequiredFieldValidator1"
controltovalidate="Date3"
OnServerValidate="Date3_Validator"
errormessage="Date Error!"
runat="Server">
</asp:CustomValidator></td>
</tr>
<asp:HiddenField ID="Supplier" Value='<%# Eval("cdf_supplier_tx") %>' runat="server" />
<asp:HiddenField ID="PrefSupplier" Value='<%# Eval("cdf_supplier_pref") %>' runat="server" />
<asp:HiddenField ID="Nominal" Value='<%# Eval("Nominal") %>' runat="server" />
<asp:HiddenField ID="QuoteCost" Value='<%# Eval("QuoteCost") %>' runat="server" />
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
<SeparatorStyle BackColor="#C0FFFF" />
<SeparatorTemplate>
</SeparatorTemplate>
</asp:DataList>
EDIT: Some of the VB that's been tried and tested & A little of my own that G_Wilson has tried helping me with but i can't grasp on.
Protected Sub Save_Btn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Save_Btn.Click
'connection.Open()
'command = New SqlCommand("Select * from impsod_h where [Quote Number]='" + HiddenQno.Value + "'", connection)
'datareader = command.ExecuteReader()
'If datareader.HasRows = False Then
' datareader.Close()
' CreateImpsod1()
' CreateIMPSOH1()
' installcalc()
'Else
' datareader.Close()
'End If
'connection.Close()
For Each Row As GridViewRow In GridView1.Rows
Dim ThisCheck As String
ThisCheck = ChkItem.Checked
Next
End Sub
What i think you will need is a For Each Loop.
That will look a little something like this :
For Each Row as GridViewRow in GridView1.Rows
Dim chkSelect as CheckBox
chkSelect = e.Row.FindControl("ChkItem")
If chkSelect.Checked = True Then
'Put vb.net logic here ...
Else
'Put anything else here ...
End If
Next
That should do the trick.
I am using UpdatePanel control in the middle of the page for partial postback of Address Type radio button change. Everything works fine but I am struggling with alignment issue. The controls inside the UpdatePanel do not align with outside controls. How could I solve this issue? Please let me know.
<table id="tblEdit" class="cssclass1" cellpadding="3" runat="server">
<tr>
<td class="cssclass1" align="right">
Title
</td>
<td>
<telerik:RadTextBox ID="textbox1" runat="server" Width="280px" ReadOnly="true"
BackColor="LightGray" />
</td>
<td align="right">
<asp:Label CssClass="cssclass1" ID="LblFirstName" runat="server">First Name</asp:Label>
</td>
<td align="left">
<telerik:RadTextBox ID="txtFirstName" runat="server" MaxLength="30">
</telerik:RadTextBox>
<asp:Image ID="Image1" ImageUrl="../../../images/requiredfield.gif" AlternateText="Required Field"
runat="server"></asp:Image><asp:HiddenField ID="hfCaseEntityId" runat="server" />
</td>
</tr>
<tr>
<td colspan="4">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<tr>
<td class="cssclass1" align="right">
Address Type
</td>
<td align="left">
<asp:RadioButtonList ID="AddressType" runat="server" RepeatDirection="Horizontal" OnSelectedIndexChanged="AddressType_SelectedIndexChanged" AutoPostBack="true" >
<asp:ListItem Value="1" Selected="True">Home</asp:ListItem>
<asp:ListItem Value="2">Work</asp:ListItem>
</asp:RadioButtonList>
</td>
<td class="cssclass1" align="right">
</td>
<td align="left">
</td>
</tr>
<tr>
<td align="right">
<asp:Label CssClass="cssclass1" ID="LblHomeStreet1" runat="server">Address</asp:Label>
</td>
<td align="left">
<telerik:RadTextBox ID="txtHomeStreet1" runat="server" MaxLength="40" >
</telerik:RadTextBox>
<asp:Image ID="Image10" ImageUrl="../../../images/requiredfield.gif" AlternateText="Required Field"
runat="server"></asp:Image>
</td>
<td align="right">
<asp:Label CssClass="cssclass1" ID="LblHomeStreet2" runat="server">Street 2</asp:Label>
</td>
<td align="left">
<telerik:RadTextBox ID="txtHomeStreet2" runat="server" MaxLength="40" Width="280px">
</telerik:RadTextBox>
</td>
</tr>
<tr>
<td align="right">
<asp:Label CssClass="cssclass1" ID="LblHomeCity" runat="server">City</asp:Label>
</td>
<td align="left">
<telerik:RadTextBox ID="txtHomeCity" runat="server" MaxLength="30">
</telerik:RadTextBox>
</td>
<td align="right">
<asp:Label CssClass="cssclass1" ID="LblHomeState" runat="server">State</asp:Label>
</td>
<td align="left">
<telerik:RadTextBox ID="txtHomeState" runat="server" MaxLength="30">
</telerik:RadTextBox>
</td>
</tr>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
</table>
Your HTML is invalid. The first line in your <ContentTemplate> is a <tr>, however, it looks like you are trying to include another <table> there. You might want to look into cellpading=0 and cellspacing=0 on your inner table. Also, you could add a CSSClass to your UpdatePanel to do any additional formatting.
I'm new in ASP.net and started my first Website Project. I want to connect the text box to my table which is "Details" please see the code below:
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<p class="style2">
<br />
DETAILS FORMS</p>
<p>
<table style="width: 100%; height: 117px;">
<tr>
<td class="style4">
<asp:Label ID="Label1" runat="server" Text="ID :"></asp:Label>
</td>
<td class="style3">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
<td class="style3">
</td>
</tr>
<tr>
<td class="style5">
<asp:Label ID="Label2" runat="server" Text="Date Recieved :"></asp:Label>
</td>
<td>
<asp:TextBox ID="DRInput" runat="server"></asp:TextBox>
</td>
<td>
</td>
</tr>
<tr>
<td class="style5">
<asp:Label ID="Label3" runat="server" Text="Date Commision :"></asp:Label>
</td>
<td>
<asp:TextBox ID="DCINput" runat="server"></asp:TextBox>
</td>
<td>
</td>
</tr>
<tr>
<td class="style5">
<asp:Label ID="Label4" runat="server" Text="Sender"></asp:Label>
</td>
<td>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True">
<asp:ListItem>Angeles</asp:ListItem>
<asp:ListItem>Aurora</asp:ListItem>
<asp:ListItem>Bataan</asp:ListItem>
<asp:ListItem>Bulacan</asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:Database1ConnectionString1 %>"
SelectCommand="SELECT [Sender] FROM [Details]"></asp:SqlDataSource>
</td>
<td>
</td>
</tr>
<tr>
<td class="style10">
</td>
<td class="style11">
<asp:Button ID="Button1" runat="server" Text="Button" />
</td>
<td class="style11">
</td>
</tr>
<tr>
<td class="style6">
</td>
<td class="style7">
</td>
<td class="style7">
</td>
</tr>
</table>
</p>
</asp:Content>
And this is the Code behind it:
public partial class Data : System.Web.UI.Page
{
protected void DRInput_DataBinding(object sender, EventArgs e)
{
}
What would be my code to bind the textbox to save details in my table "Details" and when I click the button it will be save on table "Details" . Hoping anyone could help. Thanks in advance.
In you particular case it doesn't look like you're displaying a list of data but instead the details of an item.
The simple approach would be to assign the text property of the textbox as part of the page request eg within page load event of the page.
DRInput.Text = detailsModel.DRInput;
and then when the page is submitted assign the textbox's text value back to your object.
detailsModel.DRInput = DRInput.Text;
Since you're new to ASP.Net; perhaps best to start with tutorial sites for example w3schools.com/aspnet/aspnet_demo_intro.asp or asp.net/web-forms then come back and ask your questions
I'm using a calendar extender in a panel which popup using modalpopup extender, so panel is poped up contains the calendar extender but the calendar is behind every thing, i tried to change the z-index but all in vain, seems to me that it is a bug in the ASP.net AjaxToolKit.Any one has an idea about this problem and if it can be solved?
Edit:
<style type="text/css">
.modalBackground
{
background-color: Gray;
filter: alpha(opacity=70);
opacity: 0.2;
}
.ob_show_panelsholder
{
border: 1px solid #736F6E;
}
.enterzipCalenderCompliant {
PADDING-RIGHT: 10px; FLOAT: left /*No display=inline*/
}
.ajax__calendar_container { z-index : 1000 ; }
</style>
<script type="text/javascript">
function calendarShown(sender, args) {
sender.style.zIndex = 10005;
}
</script>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel ID="_pnlShowPersonalData" runat="server">
<table class="style1">
<tr>
<td>
<asp:Image ID="_imgCurrentPP" runat="server" Height="100px" Width="100px" />
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label3" runat="server" Text="First name :"></asp:Label>
</td>
<td>
<asp:Label ID="_lblFirstName" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label5" runat="server" Text="Last name :"></asp:Label>
</td>
<td>
<asp:Label ID="_lblLastName" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label7" runat="server" Text="BirthDate :"></asp:Label>
</td>
<td>
<asp:Label ID="_lblBirthDate" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label10" runat="server" Text="Mobile number :"></asp:Label>
</td>
<td>
<asp:Label ID="_lblMobileNumber" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label12" runat="server" Text="Location :"></asp:Label>
</td>
<td>
<asp:Label ID="_lblLocation" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label13" runat="server" Text="Gender :"></asp:Label>
</td>
<td>
<asp:Label ID="_lblGender" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Button ID="_btnEditPersonalData" runat="server" Text="Edit Profile" />
<asp:ModalPopupExtender ID="_btnEditPersonalData_ModalPopupExtender" runat="server"
DynamicServicePath="" Enabled="True" TargetControlID="_btnEditPersonalData" BackgroundCssClass="modalBackground"
PopupControlID="_pnlEditPersonalData" CancelControlID="_btnCancel">
</asp:ModalPopupExtender>
</td>
</tr>
</table>
</asp:Panel>
<asp:Panel ID="_pnlEditPersonalData" runat="server">
<table>
<tr>
<td>
<asp:Label ID="_FirstName" runat="server" Text="First name :" ></asp:Label>
</td>
<td>
<asp:TextBox ID="_txtFirstName" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="_LastName" runat="server" Text="Last name :"></asp:Label>
</td>
<td>
<asp:TextBox ID="_txtLastName" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="_BirthDate" runat="server" Text="Birth date :"></asp:Label>
</td>
<td class="ajax__calendar_container">
<asp:TextBox ID="_txtBirthDate" runat="server"></asp:TextBox>
<asp:MaskedEditExtender ID="_txtBirthDate_MaskedEditExtender" runat="server" Enabled="True"
TargetControlID="_txtBirthDate" MaskType="Date" ErrorTooltipEnabled="True" MessageValidatorTip="true"
Mask="99/99/9999">
</asp:MaskedEditExtender>
<div>
<asp:CalendarExtender ID="_txtBirthDate_CalendarExtender" runat="server" Enabled="True"
PopupButtonID="_btnCalendar" TargetControlID="_txtBirthDate">
</asp:CalendarExtender>
</div>
<asp:ImageButton ID="_btnCalendar" runat="server" ImageUrl="~/Images/calendar_button_b.jpg" />
<%-- <img alt="Icon" src="~/Images/calendar_button_b.jpg" id="Image1" />--%>
</td>
</tr>
<tr>
<td>
<asp:Label ID="_ProfilePic" runat="server" Text="Profile picture :"></asp:Label>
</td>
<td>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Label ID="Label1" runat="server"></asp:Label>
<%-- <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ControlToValidate="FileUpload1"--%><%-- ErrorMessage="*" ValidationGroup="signup"></asp:RequiredFieldValidator>--%>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ValidationExpression="^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))(.png|.jpg)$"
ControlToValidate="FileUpload1" ErrorMessage="Please Select Png or Jpg File"
ValidationGroup="UploadFile"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="_MobileNumber" runat="server" Text="Mobile number :"></asp:Label>
</td>
<td>
<asp:TextBox ID="_txtMobileNumber" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="_Password" runat="server" Text="Password :"></asp:Label>
</td>
<td>
<asp:TextBox ID="_txtPassword" runat="server"></asp:TextBox>
</td>
</tr>
</table>
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel ID="_pnlLocation" runat="server">
<table width="21%">
<tr>
<td>
<asp:Label ID="_Country" runat="server" Text="Country :"></asp:Label>
</td>
<td>
<uc1:CountryListUC ID="CountryListUC1" runat="server" EnablePostBack="True" EnableValidation="False"
OnListIndexChanged="CountrySelectedIndexChanged" />
</td>
</tr>
<tr>
<td>
<asp:Label ID="_Governet" runat="server" Text="Governet:"></asp:Label>
</td>
<td>
<uc2:GovernateListUC ID="GovernateListUC1" runat="server" OnListIndexChanged="GovernateSelectedIndexChanged"
Enabled="False" EnablePostBack="True" EnableValidation="False" />
</td>
</tr>
<tr>
<td>
<asp:Label ID="_District" runat="server" Text="District :"></asp:Label>
</td>
<td>
<uc3:DistrictListUC ID="DistrictListUC1" runat="server" Enabled="False" EnablePostBack="True"
EnableValidation="False" />
</td>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="CountryListUC1" EventName="ListIndexChanged" />
</Triggers>
</asp:UpdatePanel>
<table width="22%">
<tr>
<td>
<asp:Label ID="_Gender" runat="server" Text="Gender :"></asp:Label>
</td>
<td>
<asp:DropDownList ID="_ddlGender" runat="server">
<asp:ListItem Value="1">Male</asp:ListItem>
<asp:ListItem Value="2">Female</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<asp:Button ID="_btnSaveChanges" runat="server" OnClick="_btnSaveChages_Click" Text="Save changes"
ValidationGroup="signup" />
</td>
<td valign="bottom">
<asp:Button ID="_btnCancel" runat="server" Text="Cancel" />
</td>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
is the calendar extender an ajax extender or did you mean the asp calendar control? Either way I've tried both in your same situation described and it works. Try posting some code you are using so we can see where the issue lies and be of further assistance.
Edit: here's the code I used from yours. I took out the usercontrols so I could debug the page and it seemed to work. Here's an a screenshot
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="web.test" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.modalBackground
{
background-color: Gray;
filter: alpha(opacity=70);
opacity: 0.2;
}
.ob_show_panelsholder
{
border: 1px solid #736F6E;
}
.enterzipCalenderCompliant {
PADDING-RIGHT: 10px; FLOAT: left /*No display=inline*/
}
.ajax__calendar_container { z-index : 1000 ; }
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="smtest" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel ID="_pnlShowPersonalData" runat="server">
<table class="style1">
<tr>
<td>
<asp:Image ID="_imgCurrentPP" runat="server" Height="100px" Width="100px" />
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label3" runat="server" Text="First name :"></asp:Label>
</td>
<td>
<asp:Label ID="_lblFirstName" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label5" runat="server" Text="Last name :"></asp:Label>
</td>
<td>
<asp:Label ID="_lblLastName" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label7" runat="server" Text="BirthDate :"></asp:Label>
</td>
<td>
<asp:Label ID="_lblBirthDate" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label10" runat="server" Text="Mobile number :"></asp:Label>
</td>
<td>
<asp:Label ID="_lblMobileNumber" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label12" runat="server" Text="Location :"></asp:Label>
</td>
<td>
<asp:Label ID="_lblLocation" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label13" runat="server" Text="Gender :"></asp:Label>
</td>
<td>
<asp:Label ID="_lblGender" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Button ID="_btnEditPersonalData" runat="server" Text="Edit Profile" />
<ajaxToolkit:ModalPopupExtender ID="_btnEditPersonalData_ModalPopupExtender" runat="server" TargetControlID="_btnEditPersonalData" BackgroundCssClass="modalBackground" PopupControlID="_pnlEditPersonalData" CancelControlID="_btnCancel" />
</td>
</tr>
</table>
</asp:Panel>
<asp:Panel ID="_pnlEditPersonalData" runat="server">
<table>
<tr>
<td>
<asp:Label ID="_FirstName" runat="server" Text="First name :" ></asp:Label>
</td>
<td>
<asp:TextBox ID="_txtFirstName" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="_LastName" runat="server" Text="Last name :"></asp:Label>
</td>
<td>
<asp:TextBox ID="_txtLastName" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="_BirthDate" runat="server" Text="Birth date :"></asp:Label>
</td>
<td class="ajax__calendar_container">
<asp:TextBox ID="_txtBirthDate" runat="server"></asp:TextBox>
<ajaxtoolkit:MaskedEditExtender ID="_txtBirthDate_MaskedEditExtender" runat="server" Enabled="True"
TargetControlID="_txtBirthDate" MaskType="Date" ErrorTooltipEnabled="True" MessageValidatorTip="true"
Mask="99/99/9999">
</ajaxtoolkit:MaskedEditExtender>
<div>
<ajaxtoolkit:CalendarExtender ID="_txtBirthDate_CalendarExtender" runat="server" Enabled="True"
PopupButtonID="_btnCalendar" TargetControlID="_txtBirthDate">
</ajaxtoolkit:CalendarExtender>
</div>
<asp:ImageButton ID="_btnCalendar" runat="server" ImageUrl="~/Images/calendar_button_b.jpg" />
<%-- <img alt="Icon" src="~/Images/calendar_button_b.jpg" id="Image1" />--%>
</td>
</tr>
<tr>
<td>
<asp:Label ID="_ProfilePic" runat="server" Text="Profile picture :"></asp:Label>
</td>
<td>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Label ID="Label1" runat="server"></asp:Label>
<%-- <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ControlToValidate="FileUpload1"--%><%-- ErrorMessage="*" ValidationGroup="signup"></asp:RequiredFieldValidator>--%>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ValidationExpression="^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))(.png|.jpg)$"
ControlToValidate="FileUpload1" ErrorMessage="Please Select Png or Jpg File"
ValidationGroup="UploadFile"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="_MobileNumber" runat="server" Text="Mobile number :"></asp:Label>
</td>
<td>
<asp:TextBox ID="_txtMobileNumber" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="_Password" runat="server" Text="Password :"></asp:Label>
</td>
<td>
<asp:TextBox ID="_txtPassword" runat="server"></asp:TextBox>
</td>
</tr>
</table>
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel ID="_pnlLocation" runat="server">
<table width="21%">
<tr>
<td>
<asp:Label ID="_Country" runat="server" Text="Country :"></asp:Label>
</td>
<td>
</td>
</tr>
<tr>
<td>
<asp:Label ID="_Governet" runat="server" Text="Governet:"></asp:Label>
</td>
<td>
</td>
</tr>
<tr>
<td>
<asp:Label ID="_District" runat="server" Text="District :"></asp:Label>
</td>
<td>
</td>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
<Triggers>
</Triggers>
</asp:UpdatePanel>
<table width="22%">
<tr>
<td>
<asp:Label ID="_Gender" runat="server" Text="Gender :"></asp:Label>
</td>
<td>
<asp:DropDownList ID="_ddlGender" runat="server">
<asp:ListItem Value="1">Male</asp:ListItem>
<asp:ListItem Value="2">Female</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<asp:Button ID="_btnSaveChanges" runat="server" Text="Save changes"
ValidationGroup="signup" />
</td>
<td valign="bottom">
<asp:Button ID="_btnCancel" runat="server" Text="Cancel" />
</td>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>
CSS solution that worked for me:
.ajax__calendar_container
{
position :absolute;
z-index : 100003 !important;
}
Make sure to use !important declaration. Without it z-index was always overwrited by higher settings. You should also check z-index in css for popup dialog and it's background.
I have a formview with several data items that works perfectly except for a single parameter that will not update with the rest of them. The formview's datasource updateparameter is set to do nothing so that I can handle the update in codebehind. Every item works fine, except for one parameter ("salesprice") that is missing in the OldValues and NewValues argument of the ItemUpdating event of the formview. The data DOES pull in to the textbox as it should, formatted properly and all.
I've attached the html, SQL (for getLoanData()), and the codebehind.
Why would every parameter exist in the New/OldValue arguments except the "salesprice" parameter? I've tried populating the textbox without the formatstring, and it's still missing. Is there something about a money SQL datatype that might cause a problem?
HTML:
<asp:FormView ID="fvLoanDetails" runat="server" DataKeyNames="orderid"
DataSourceID="sqlLoanDetails" Width="100%">
<ItemTemplate>
...
</ItemTemplate>
<EditItemTemplate>
<table class="orderSectionHeader">
<tr>
<td style="padding-left:10px;">
<h2>Loan Details</h2>
</td>
<td style="text-align:right;">
<asp:Button ID="btnCancel" runat="server" Text="Cancel" CommandName="Cancel" />
<asp:Button ID="bvnSave" runat="server" Text="Save" CommandName="Update" />
</td>
</tr>
</table>
<table class="orderSection">
<tr>
<td class="orderHeader" style="vertical-align:top;">
Loan Number
</td>
<td>
<asp:Label ID="lblLoanNumber" CssClass="orderData" runat="server"
Text='<%# Bind("loannumber") %>' />
</td>
</tr>
<tr>
<td class="orderHeader">
Business Channel
</td>
<td>
<asp:DropDownList ID="ddlBusinessChannel" runat="server"
DataSourceID="sqlBusinessChannels" DataTextField="BusinessChannel"
DataValueField="BusinessChannel" SelectedValue='<%# Bind("businesschannel") %>'>
</asp:DropDownList>
<asp:SqlDataSource ID="sqlBusinessChannels" runat="server"
ConnectionString="<%$ ConnectionStrings:Jade_4 %>"
SelectCommand="SELECT DISTINCT [BusinessChannel] FROM [Loans] ORDER BY [BusinessChannel]">
</asp:SqlDataSource>
</td>
</tr>
<tr>
<td class="orderHeader">
Loan Type
</td>
<td>
<asp:DropDownList ID="ddlLoanType" runat="server"
DataSourceID="sqlLoanType" DataTextField="LoanType"
DataValueField="LoanType" SelectedValue='<%# Bind("loantype") %>'>
</asp:DropDownList>
<asp:SqlDataSource ID="sqlLoanType" runat="server"
ConnectionString="<%$ ConnectionStrings:Jade_4 %>"
SelectCommand="SELECT DISTINCT [LoanType] FROM [Loans] ORDER BY [LoanType]">
</asp:SqlDataSource>
</td>
</tr>
<tr>
<td class="orderHeader">
Purpose
</td>
<td>
<asp:DropDownList ID="ddlPurpose" runat="server"
SelectedValue='<%# Bind("purpose") %>'>
<asp:ListItem Text="Purchase" Value="False" />
<asp:ListItem Text="Refinance" Value="True" />
</asp:DropDownList>
</td>
</tr>
<tr id="trSalesPrice" runat="server">
<td class="orderHeader">
Sales Price
</td>
<td>
<asp:TextBox ID="txtSalesPrice" CssClass="orderData" runat="server" Width="100"
Text='<%# Bind("salesprice", "{0:F2}") %>' />
</td>
</tr>
<tr>
<td class="orderHeader">
Borrower
</td>
<td>
<table cellspacing="0">
<tr style="font-size:8pt;padding-bottom:0px;">
<td>First</td><td>Last</td>
</tr>
<tr>
<td>
<asp:TextBox ID="txtBFirst" CssClass="orderData" runat="server" Width="80"
Text='<%# Bind("firstname") %>' />
</td>
<td>
<asp:TextBox ID="txtBLast" CssClass="orderData" runat="server" Width="120"
Text='<%# Bind("lastname") %>' />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="orderHeader">
Borrower Email
</td>
<td>
<asp:TextBox ID="txtEmail" CssClass="orderData" runat="server" Width="200"
Text='<%# Bind("email") %>' />
</td>
</tr>
<tr>
<td class="orderHeader" style="vertical-align:top;">
Mailing Address
</td>
<td>
<table cellspacing="0">
<tr style="font-size:8pt;padding-bottom:0px;">
<td colspan="3">Address</td>
</tr>
<tr>
<td colspan="3">
<asp:TextBox ID="txtAddress" CssClass="orderData" runat="server" Width="200"
Text='<%# Bind("address") %>' />
</td>
</tr>
<tr style="font-size:8pt;padding-bottom:0px;">
<td>City</td><td>State</td><td>Zip</td>
</tr>
<tr>
<td>
<asp:TextBox ID="txtCity" CssClass="orderData" runat="server" Width="100"
Text='<%# Bind("city") %>' />
</td>
<td>
<asp:TextBox ID="txtState" CssClass="orderData" runat="server" Width="30"
Text='<%# Bind("state") %>' />
</td>
<td>
<asp:TextBox ID="txtZip" CssClass="orderData" runat="server" Width="50"
Text='<%# Bind("zip") %>' />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="orderHeader">
Borrower Primary
</td>
<td>
<asp:TextBox ID="txtBPhone" CssClass="orderData" runat="server"
Text='<%# Bind("phone1", "{0:(###) ###-####}")%>' />
</td>
</tr>
<tr>
<td class="orderHeader">
Borrower Secondary
</td>
<td>
<asp:TextBox ID="txtBCell" CssClass="orderData" runat="server"
Text='<%# Bind("phone2", "{0:(###) ###-####}")%>' />
</td>
</tr>
</table>
</EditItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="sqlLoanDetails" runat="server"
ConnectionString="<%$ ConnectionStrings:Jade_4 %>"
SelectCommand="select #orderid as orderid, * from dbo.getLoanData(#orderid)"
UpdateCommand="select #orderid">
<SelectParameters>
<asp:ControlParameter ControlID="hdnOrderID" Name="orderid"
PropertyName="Value" DefaultValue="0" />
</SelectParameters>
</asp:SqlDataSource>
VB.NET:
Protected Sub fvLoanDetails_ItemUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewUpdateEventArgs) Handles fvLoanDetails.ItemUpdating
Dim o As Order = DAL.GetOrderById(hdnOrderID.Value)
Dim l As Loan = DAL.GetLoanByLoanID(o.LoanID)
Dim b As Contact = DAL.GetContactById(l.BorrowerContactID)
l.BusinessChannel = e.NewValues("businesschannel")
l.LoanType = e.NewValues("loantype")
l.Purpose = e.NewValues("purpose")
l.SalesPrice = e.NewValues("salesprice")
DAL.UpdateLoan(l)
b.FirstName = e.NewValues("firstname")
b.LastName = e.NewValues("lastname")
b.Address = e.NewValues("address")
b.City = e.NewValues("city")
b.State = e.NewValues("state")
b.Zip = e.NewValues("zip")
b.Phone = e.NewValues("phone1")
b.Cell = e.NewValues("phone2")
DAL.UpdateContact(b)
End Sub
SQL:
select
l.loannumber, l.businesschannel, l.loantype, l.purpose, l.salesprice, b.firstname, b.lastname, b.email,
b.address, b.city, b.state, b.zip, b.phone as phone1, b.cell as phone2,
dbo.formataddressweb(b.address, '', b.city, b.state, b.zip) as mailingaddress from loans l
join orders o on o.orderid=#orderid
join contacts b on l.borrowercontactid=b.contactid
where l.loanid=(select loanid from orders where orderid=#orderid)
Have you tried a different format string?
Text='<%# Bind("salesprice", "{0:C}") %>'