In my page, I have one search button and a repeater. I have wrapped everything inside UpdatePanel. My search button do not causes full postback, i.e ideal but RadioButtonList inside Repeater control does. I have no idea what to do.
<asp:UpdatePanel ID="up" runat="server">
<ContentTemplate>
<table align="center" border="1" cellspacing="0" class="tabmn6">
<tr id="trheader" runat="server">
<th id="trEdit" runat="server">Edit</th>
<th>User Name </th>
<th>Role</th>
<th>From Date</th>
<th>To Date</th>
<th>Comment</th>
<th>Status</th>
</tr>
<asp:Repeater ID="rpUserDetails" runat="server" OnItemDataBound="rpUserDetails_ItemDataBound">
<ItemTemplate>
<tr>
<td id="tdRPEdit" runat="server" align="center">
<input type="button" class="editbtn" name="btnEdit" id="btnEdit" runat="server" onclick='<%# string.Format("javascript:return AddBoardCast(\"{0},{1}\")", Eval("BC_ID"),"Edit") %>'>
</td>
<td id="trRPTL" runat="server" align="center">
<asp:Label ID="lblUName" runat="server" ForeColor="Red" Text='<%#Eval("UserName")%>' />
</td>
<td align="center">
<asp:Label ID="lblRoleName" runat="server" ForeColor="Black" Text='<%#Eval("RoleName")%>' />
</td>
<td align="center">
<asp:Label ID="lblToDate" runat="server" ForeColor="Black"><%#DataBinder.Eval(Container.DataItem, "BC_FromDate", "{0:dd/MM/yyyy}")%></asp:Label>
</td>
<td align="center"><asp:Label ID="lblFromDate" runat="server" ForeColor="Black"><%#DataBinder.Eval(Container.DataItem, "BC_TODate", "{0:dd/MM/yyyy}")%></asp:Label></td>
<td align="center" width="20%">
<div style="color: black"><%#Eval("BC_Comment")%></div>
</td>
<td align="center">
<asp:HiddenField ID="hdnBC_ID" runat="server" Value='<%#Eval("BC_ID") %>' />
<asp:HiddenField ID="hdnUserID" runat="server" Value='<%#Eval("UserID") %>' />
<asp:RadioButtonList ID="rdStatus" runat="server" Height="48px" RepeatDirection="Horizontal" AutoPostBack="true" OnSelectedIndexChanged="rdStatus_SelectedIndexChanged" CssClass="rad">
<asp:ListItem Text="Active" Value="1"></asp:ListItem>
<asp:ListItem Text="Deactive" Value="0"></asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</ContentTemplate>
</asp:UpdatePanel>
Related
On chkSubModuleView_CheckedChanged() event iwant to get the id of chkModule.Please tell me how to get the id or reference of parent checkbox on click of child checkbox in server side.How to distinguish between different modules .
enter code here
<asp:ListView ID="lvModule" runat="server">
<LayoutTemplate>
<table width="600px" border="0" cellpadding="0" cellspacing="0"
class="ListViewtable">
<tr>
<th style="width: 10%;">
Modules
</th>
</tr>
<asp:PlaceHolder ID="itemPlaceholder" runat="server">
</asp:PlaceHolder>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td>
<asp:CheckBox ID="chkModule" runat="server"
CausesValidation="false" AutoPostBack="true"
OnCheckedChanged="chkModule_CheckedChanged" >
</asp:CheckBox><asp:HiddenField ID="hfEntityName"
Value='<%# Eval("EntityName") %>' runat="server" />
<%# Eval("Title")%>
<asp:HiddenField ID="hfID" Value='<%# Eval("ID") %>'
runat="server" />
<asp:Label ID="label" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td colspan="2" style="padding-left: 20px;">
<asp:ListView ID="lvSubModule" runat="server">
<LayoutTemplate>
<table width="100%" cellspacing="0" border="0"
class="ListViewtableLayer2">
<tr>
<th style="width: 20%;">
Sub Module
</th>
<th style="width: 20%;">
<asp:CheckBox ID="chkSubModuleView"
Checked="true" runat="server" AutoPostBack="true"
OnCheckedChanged="chkSubModuleView_CheckedChanged" />
View
</th>
</tr>
<asp:PlaceHolder ID="itemPlaceholder"
runat="server"></asp:PlaceHolder>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td>
<%# Eval("Title")%>
<asp:HiddenField ID="hfMenuID" Value='<%#
Eval("MenuID") %>' runat="server" />
<asp:HiddenField ID="hfName" Value='<%#
Eval("HeaderID") %>' runat="server" />
</td>
<td>
<asp:CheckBox ID="chkRead" runat="server"
AutoPostBack="true" Checked="true" CausesValidation="false"
OnCheckedChanged="chkRead_CheckedChanged"></asp:CheckBox>
</td>
</tr>
</ItemTemplate>
</asp:ListView>
</td>
</tr>
</ItemTemplate>
</asp:ListView>
change your checkbox property to
<asp:CheckBox ID="chkSubModuleView"
Checked="true" runat="server" AutoPostBack="true" Key='<%# Eval("ID")%>'
OnCheckedChanged="chkSubModuleView_CheckedChanged" />
In your .cs
protected void chkSubModuleView_CheckedChanged(object sender, EventArgs e)
{
CheckBox chk = (CheckBox)sender;
string yourID = chk.Attributes["Key"].ToString();
}
I have TabControl(AjaxToolKit) having 2 Nested ListViews.
code:
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:TabContainer ID="tcQuestions" runat="server" ActiveTabIndex="0" OnDemand="true" AutoPostBack="false" TabStripPlacement="Top" ScrollBars="None" UseVerticalStripPlacement="false">
<asp:TabPanel ID="tpFirst" runat="server" HeaderText="Page 1" Enabled="true" ScrollBars="Auto"
OnDemandMode="Once">
<ContentTemplate>
<asp:Panel ID="pnlNoData" runat="server">
<asp:LinkButton ID="lbQuestionsAdd" Text="Add Question" runat="server" />
</asp:Panel>
<asp:Panel ID="pnlListView" runat="server">
<asp:ListView ID="lsvQuestions" runat="server" ItemPlaceholderID="phItemPlaceHoler">
<EmptyDataTemplate>
<em>NO RECORD WAS FOUND</em>
</EmptyDataTemplate>
<ItemTemplate>
<tr>
<td>
<asp:Label ID="lblQuestionID" Text='<%#Eval("intQuesId") %>' Visible="false" runat="server" />
<asp:Label ID="lblQuestionTitle" Text='<%#Eval("strQuesTitle") %>' runat="server" />
<%--1.Are you doing job?--%>
</td>
</tr>
<%--Inner Listview--%>
<asp:ListView ID="lsvAnswers" runat="server" ItemPlaceholderID="phItemPlaceHolerAnswers">
<LayoutTemplate>
<table runat="server" id="table1">
<tr runat="server" id="phItemPlaceHolerAnswers">
</tr>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td>
<asp:PlaceHolder ID="plControl" runat="server" />
</td>
</tr>
</ItemTemplate>
<EmptyDataTemplate>
<em>NO RECORD WAS FOUND</em>
</EmptyDataTemplate>
</asp:ListView>
</ItemTemplate>
<LayoutTemplate>
<table class="tblAll">
<tbody>
<tr>
<td style="width: 125px">
<asp:LinkButton ID="lbtnAddQuestions" runat="server">Add Questions</asp:LinkButton>
</td>
<td style="width: 316px">
<asp:LinkButton ID="lbtnDesignTools" runat="server">Design Tools</asp:LinkButton>
</td>
<td class="formTopLinks">
<img class="imgicons" src="../Layout/images/edit.png" />
<asp:LinkButton ID="lbEditProperties" runat="server" CssClass="lnkbuttonText">Edit Properties</asp:LinkButton>
</td>
<td class="formTopLinks">
<img class="imgicons" src="../Layout/images/Delete.png" />
<asp:LinkButton ID="lbCopyPage" runat="server" CssClass="lnkbuttonText">Copy Page</asp:LinkButton>
</td>
<td class="formTopLinks">
<img class="imgicons" src="../Layout/images/Copy.png" />
<asp:LinkButton ID="lbDeletePage" runat="server" CssClass="lnkbuttonText">Delete Page</asp:LinkButton>
</td>
<td style="width: 20px;">
<img class="imgicons" src="../Layout/images/left.png" />
</td>
<td style="width: 64px;">
<asp:Label ID="Label1" runat="server" CssClass="lnkbuttonText" Text="Move Page" />
</td>
<td style="width: 20px;">
<img class="imgicons" src="../Layout/images/right.png" />
</td>
<td>
</td>
</tr>
</tbody>
</table>
<br />
<table class="tblAll">
<tbody>
<asp:PlaceHolder ID="phItemPlaceHoler" runat="server"></asp:PlaceHolder>
</tbody>
</table>
</LayoutTemplate>
</asp:ListView>
</asp:Panel>
</ContentTemplate>
</asp:TabPanel>
</asp:TabContainer>
Where, I am getting Question from Table "Question", and its answers from another table "Answers". Each Question is linked with a PageNumber.
so, i have to create TabPanels according to PageNumber from Question, Then Bind Question Label with that Question, and fill 2nd ListView with Answers of that Question.
These answers are dynamic controls based on db entries e.g textbox, checkboxlists, radiobutton lists and may vary for every question.
Now what i am doing is copying tabPanel 1 to new TabPanel and adding question and answers according to db values, but when i am creating 2nd TabPanel, it give me error that
Cannot unregister UpdatePanel with ID 'ContentPlaceHolder1_tcQuestions_tpFirst_updatePanel' since it was not registered with the ScriptManager. This might occur if the UpdatePanel was removed from the control tree and later added again, which is not supported.
What is the best approach to handle this scenerio.
something like SurverMonkey except i am using tabs for new page.
I am using ajax tab container with update panel and file uploader
fileuploaderId.HasFille always blank.
Here is my html code
<cc1:TabPanel ID="tour" runat="server">
<HeaderTemplate>
<span class="label_Tag_big">भ्रमण (Tours)</span></HeaderTemplate>
<ContentTemplate>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<center class="control_bg">
<table width="75%" cellspacing="1">
<tr>
<td style="background-color: #996666">
<table width="100%" align="center" cellpadding="0" cellspacing="1">
<tr class="form_heading">
<td colspan="2">
<asp:Label ID="lbl" runat="server" Text="भ्रमण (Tours)"></asp:Label>
</td>
</tr>
<tr class="bgColor" align="left" valign="top">
<td>
विभागाध्यक्ष / अधिकारी का पद नाम
</td>
<td>
designation location, department
</td>
</tr>
<tr class="bgColor" align="left" valign="top">
<td>
<asp:Label ID="lblCurrentTT" runat="server"></asp:Label>
का लक्ष्य
</td>
<td>
<asp:Label ID="lblTargetT" runat="server"></asp:Label>
</td>
</tr>
<tr class="bgColor" align="left" valign="top">
<td>
<asp:Label ID="lblCurrentTA" runat="server"></asp:Label>
की लक्ष्य प्राप्ति
</td>
<td>
<asp:Label ID="lblAchivedT" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="form_sub_heading" colspan="2" align="left">
भ्रमण का विवरण (Tours details)
</td>
</tr>
<tr class="bgColor" align="left" valign="top">
<td width="45%">
दौरे का स्थान
</td>
<td width="55%">
<table width="100%" cellpadding="3" cellspacing="0">
<tr>
<td width="50%">
<asp:DropDownList ID="ddlLocLevel" runat="server" OnSelectedIndexChanged="ddlLocLevel_SelectedIndexChanged"
AutoPostBack="True" Width="200px" />
<asp:RequiredFieldValidator ID="rfqLocLevel" runat="server" InitialValue="0" ControlToValidate="ddlLocLevel"
Display="None" ErrorMessage="दौरे का स्थान चुनें " ValidationGroup="tour"></asp:RequiredFieldValidator>
</td>
<td width="50%">
<asp:DropDownList ID="ddlLocation" runat="server" OnSelectedIndexChanged="ddlLocation_SelectedIndexChanged"
AutoPostBack="True" Width="200px">
<asp:ListItem Text="-- चुनें --" Value="0"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="rfqLocation" runat="server" InitialValue="0" ControlToValidate="ddlLocation"
Display="None" ErrorMessage="-- चुनें --" ValidationGroup="tour" Enabled="false"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:DropDownList ID="ddlSubDistrict" runat="server" OnSelectedIndexChanged="ddlSubDistrict_SelectedIndexChanged"
AutoPostBack="True" Width="200px">
<asp:ListItem Text="-- तहसील चुनें --" Value="0"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="rfqddlSubDistrict" runat="server" InitialValue="0"
ControlToValidate="ddlSubDistrict" Display="None" ErrorMessage="-- चुनें --"
ValidationGroup="tour" Enabled="false"></asp:RequiredFieldValidator>
</td>
<td>
<asp:DropDownList ID="ddlPoliceStation" runat="server" Width="200px">
<asp:ListItem Text="-- पुलिस थाना चुनें --" Value="0"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="rfqddlPoliceStation" runat="server" InitialValue="0"
ControlToValidate="ddlPoliceStation" Display="None" ErrorMessage="-- पुलिस थाना चुनें --"
ValidationGroup="tour" Enabled="false"></asp:RequiredFieldValidator>
</td>
</tr>
</table>
</td>
</tr>
<tr class="bgColor" align="left" valign="top">
<td>
<asp:Label ID="lblTourStartDate" runat="server" Text="दौरे की तिथि "></asp:Label>
</td>
<td>
<asp:TextBox ID="txtTourStartDate" runat="server" Width="25%" CssClass="date" onkeypress="return false;"
onPaste="return false;"></asp:TextBox>
<cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtTourStartDate"
Format="dd/MM/yyyy">
</cc1:CalendarExtender>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtTourStartDate"
ErrorMessage="दौरे की आरम्भिक तिथि डाले" ValidationGroup="tour" Display="None"></asp:RequiredFieldValidator>
से
<asp:TextBox ID="txtTourEndDate" runat="server" Width="25%" onkeypress="return false;"
onPaste="return false;"></asp:TextBox>
<cc1:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtTourEndDate"
Format="dd/MM/yyyy">
</cc1:CalendarExtender>
तक
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtTourEndDate"
ErrorMessage="दौरे की समाप्ति तिथि डाले" ValidationGroup="tour" Display="None"></asp:RequiredFieldValidator>
</td>
</tr>
<tr class="bgColor" align="left" valign="top">
<td>
दौरे के दौरान निरीक्षण किया गया ?
</td>
<td>
<asp:RadioButtonList ID="rdbtnInsp" runat="server" RepeatDirection="Horizontal" AutoPostBack="true"
OnSelectedIndexChanged="rdbtnInsp_SelectedIndexChanged">
<asp:ListItem Text="नही" Value="0"></asp:ListItem>
<asp:ListItem Text="हाँ" Value="1"></asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
<tr class="bgColor" align="left" valign="top">
<td>
निरीक्षण नही किये जाने की स्थिति मे टिप्पणी
</td>
<td>
<asp:TextBox ID="txtConIns" runat="server" TextMode="MultiLine" MaxLength="4000"
Enabled="false" Rows="3" Width="97%"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfqConIns" runat="server" ControlToValidate="txtConIns"
ValidationGroup="tour" ErrorMessage="निरीक्षण नही किये जाने की स्थिति मे टिप्पणी डाले "
Enabled="false" Display="None">
</asp:RequiredFieldValidator>
</td>
</tr>
<tr class="bgColor" align="left" valign="top">
<td>
दौरे के दौरान रात्री विश्राम किया गया ?
</td>
<td>
<asp:RadioButtonList ID="rdbtnNHault" runat="server" RepeatDirection="Horizontal"
AutoPostBack="true" OnSelectedIndexChanged="rdbtnNHault_SelectedIndexChanged">
<asp:ListItem Text="नही" Value="0"></asp:ListItem>
<asp:ListItem Text="हाँ" Value="1"></asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
<tr class="bgColor" align="left" valign="top">
<td>
रात्री विश्राम नही किये जाने की स्थिति मे टिप्पणी
</td>
<td>
<asp:TextBox ID="txtConNHault" runat="server" TextMode="MultiLine" MaxLength="4000"
Enabled="false" Rows="3" Width="97%"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfqConNHault" runat="server" ControlToValidate="txtConNHault"
Display="None" ValidationGroup="tour" ErrorMessage="रात्री विश्राम नही किये जाने की स्थिति मे टिप्पणी डाले "
Enabled="false">
</asp:RequiredFieldValidator>
<asp:ValidationSummary ID="vsTour" runat="server" ShowSummary="False" ShowMessageBox="true"
ValidationGroup="tour" />
</td>
</tr>
<tr class="bgColor" align="left" valign="top">
<td>
<asp:Label ID="Label8" runat="server" Text="संलग्न निरीक्षण रिपोर्ट "></asp:Label>
</td>
<td>
<asp:FileUpload ID="fuTourReport" runat="server" />
<asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ErrorMessage="Only pdf file is allowed!"
ValidationExpression="^.+(.pdf|.PDF)$" ControlToValidate="fuTourReport" Display="None"
ValidationGroup="nhalt"> </asp:RegularExpressionValidator>
</td>
</tr>
<tr class="bgColor" align="left" valign="top">
<td colspan="2" align="center">
<asp:Button ID="btnSaveTour" runat="server" Text="Submit" ValidationGroup="tour"
OnClick="btnSaveTour_Click" CssClass="savetour" />
<asp:Button ID="btnCancelTour" runat="server" Text="Cancel" CausesValidation="False" />
</td>
</tr>
</table>
</td>
</tr>
</table>
<center style="padding-top: 5px">
<asp:GridView ID="grdTours" runat="server" AllowPaging="True" AutoGenerateColumns="False"
DataKeyNames="tourId" Width="100%" OnPageIndexChanging="grdTours_PageIndexChanging"
OnRowCommand="grdTours_RowCommand">
<Columns>
<asp:BoundField DataField="Location_NameH" HeaderText="दौरे का स्थान " />
<asp:BoundField DataField="tourStartDate" HeaderText="आरम्भिक तिथि" DataFormatString="{0:dd/MM/yyyy}" />
<asp:BoundField DataField="tourEndDate" HeaderText="समाप्ति की तिथि" DataFormatString="{0:dd/MM/yyyy}" />
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="lnkinsdetail" runat="server" Text="Detail" CommandName="insdetail"
CommandArgument='<%#Eval("tourId")%>'></asp:LinkButton></ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</center>
</center>
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</cc1:TabPanel>
</cc1:TabContainer>
I have already tried this
<Triggers>
<asp:PostBackTrigger ControlID="clickButton" />
</Triggers>
and
protected void Page_Init(object sender, EventArgs e)
{
PostBackTrigger trig = new PostBackTrigger();
trig.ControlID = btnSaveTour.UniqueID;
UpdatePanel1.Triggers.Add(trig);
}
but no luck ....
Unfortunately, the FileUpload control doesn't work inside an UpdatePanel
You don't have many options really other than removing the UpdatePanel or looking at working around it by using something like the AsyncFileUpload control
See this answer for some more detail
Dave
Afternoon All,
I have a web form that i wish my user to fill out. On the form i have three fields that i wish to set validation on. One of these is a normal textbox, the other a textbox associated with a calendar icon and my last field is a drop down list that has data held in it populated from an Enum list.
Im not too worried about my dropdown list yet, but i am getting slightly frustrated with my other two textboxes. I have used a 'Required Filed Validator' on both of these and only want the validation to kick in when the users clicks the submit button. At the moment if you tab or click between these two fields the validation kicks in.
Here is my web form....
<table id="table-3">
<tr>
<td style="width: 385px">
<asp:Label ID="lblOrganiser" runat="server" Text="Meeting Organiser:">
</asp:Label></td>
<td class="style4" style="width: 23px">
<asp:TextBox ID="txtOrganiser" runat="server" >
</asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldVal0"
ControlToValidate="txtOrganiser"
ErrorMessage="Meeting Organiser"
Text="*"
runat="server"/>
</td>
<td>
<asp:Label ID="lblDate" runat="server" Width="40px" Text="Date:">
</asp:Label>
</td>
<td class="style5">
<asp:TextBox ID="txtAgendaDate" runat="server" ForeColor="Black" >
</asp:TextBox>
<asp:ImageButton runat="Server" ID="ImageButton1" ImageUrl="~/images/contact_date_SM3.png"
AlternateText="Click here to display calendar" ImageAlign="AbsMiddle" />
<asp:calendarextender ID="CalendarExtender3" runat="server"
TargetControlID="txtAgendaDate" PopupButtonID="ImageButton1" Format="dd/MM/yyyy"></asp:calendarextender>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldVal1"
ControlToValidate="txtAgendaDate"
ErrorMessage="Date"
Text="*"
runat="server"/>
</td>
</tr>
<tr>
<td style="width: 385px"><asp:Label ID="lblAgendaTypeDescription" runat="server" Text="Type Of Meeting:"></asp:Label></td>
<td class="style4" style="width: 23px">
<asp:TextBox ID="txtAgendaTypeDescription" runat="server" Text="Monthly" BackColor="#F4F4F4" ReadOnly="True"></asp:TextBox>
</td>
<td></td>
<td class="style7" style="width: 24px"><asp:Label ID="lblTime" runat="server" Text="Time"></asp:Label></td>
<td><asp:TextBox ID="txtTime" runat="server"
Text="4pm" style="margin-top: 2px"></asp:TextBox></td>
<td></td>
</tr>
<tr>
<td style="width: 385px">
<asp:Label ID="lblVenue" runat="server" Text="Venue"></asp:Label>
</td>
<td class="style4" colspan="6"><asp:TextBox ID="txtVenue" runat="server"
Text="Room 1" Width="550px" TextMode="SingleLine" ></asp:TextBox></td>
</tr>
<tr>
<td style="width: 385px"><asp:Label ID="lblRead" runat="server" Text="Please Read:"></asp:Label></td>
<td class="style4" colspan="6">
<asp:TextBox ID="txtRead" runat="server"
Width="550px" TextMode="SingleLine" Font-Names="Verdana" ></asp:TextBox></td>
</tr>
<tr>
<td style="width: 385px"><asp:Label ID="lblBring" runat="server" Text="Please Bring:"></asp:Label></td>
<td class="style4" colspan="6">
<asp:TextBox ID="txtBring" runat="server"
Width="550px" TextMode="SingleLine" Font-Names="Verdana" ></asp:TextBox></td>
</tr>
<tr>
<td style="width: 385px"><asp:Label ID="lblAgendaStatus" runat="server" Text = "Agenda Status" ></asp:Label></td>
<td class="style4" style="width: 23px">
<asp:DropDownList ID="AgendaStatus"
runat="server" Height="24px" Width="125px"> </asp:DropDownList>
</td>
<td> <asp:RequiredFieldValidator ID="RequiredFieldVal2"
ControlToValidate="AgendaStatus"
ErrorMessage="Agenda Status"
Text="*"
runat="server"/>
</td>
</tr>
</table>
<br />
<asp:ValidationSummary ID="ValidationSummary2"
HeaderText="You must enter a value in the following fields:"
DisplayMode="BulletList"
EnableClientScript="true"
runat="server"/>
<br />
<div style="text-align: right;">
<asp:ImageButton runat="Server" ID="btnAddMonthlyTemplate" ImageUrl="~/images/Addbutton.png"
AlternateText="Add Weekly Template" />
</div>
If anyone cant point me in the right direction that would be great. Many thanks in advance.
Betty
You can set the EnableClientScript property of the RequiredFieldValidator to false:
<asp:RequiredFieldValidator ID="RequiredFieldVal1"
ControlToValidate="txtAgendaDate"
ErrorMessage="Date"
Text="*"
EnableClientScript="false"
runat="server"/>
that way the validation will accur only after the user posts the form.
Hope this helps,
Shai.
I have a page that has an ASP.NET UpdatePanel on it. The UpdatePanel contains a repeater, and within the repeater is a command button. (please see the code example below)
When I click on the button the first time, nothing happens. But the second time I click on the same button, then I get the event I was expecting triggered. I am at a loss as to why this is, though I am sure there is a simple explanation. Any advice would be helpful.
<!-- Drivers Table -->
<asp:UpdatePanel runat="server" ID="DriverUpdatePanel" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<asp:HiddenField runat="server" ID="DriverErrors" />
<asp:Repeater ID="DriverRepeater" runat="server" OnItemDataBound="DriverRepeater_ItemDataBound" OnItemCommand="DriverRepeater_ItemCommand">
<HeaderTemplate>
<table cellspacing="0" class="section-table">
<tr>
<td class="bg_mid" colspan="7"><img src="/images/sections/drivers.png" alt="Drivers" /></td>
</tr>
<tr>
<td class="text_1 left-cell">#</td>
<td class="text_1">Name</td>
<td class="text_1">Date Of Birth</td>
<td class="text_1">Gender</td>
<td class="text_1">License #</td>
<td class="text_1">Relationship</td>
<td class="text_1" align="right"> </td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr id="DriverRow" runat="server">
<td class="text_2 required left-cell"><asp:Label ID="DriverNumber" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "DriverNumber")%>'></asp:Label></td>
<td class="text_2 required"><asp:Label ID="DriverName" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "FirstName")%>'></asp:Label></td>
<td class="text_2 required"><asp:Label ID="BirthDate" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "BirthDate")%>'></asp:Label></td>
<td class="text_2 required"><asp:Label ID="Gender" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "Gender").ToString() == "F" ? "Female" : "Male" %>'></asp:Label></td>
<td class="text_2 required"><asp:Label ID="DriversLicenseNumber" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "LicenseInformation.DriversLicenseNumber")%>'></asp:Label></td>
<td class="text_2 required"><asp:Label ID="RelationshipToApplicant" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "RelationshipToApplicant")%>'></asp:Label></td>
<td class="text_2 right-cell" align="right"><asp:ImageButton runat="server" ID="DriverEditButton"
ImageUrl="/images/edit.jpg" AlternateText="Edit" CommandName="Edit" CausesValidation="false" /></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</ContentTemplate>
</asp:UpdatePanel>
make UpdatePanel Mode="Conditional" and enableviewstate="true"
you not need to defined trigger and you work is done without it.