Sorting in Repeater - c#

Here is my code
<asp:Repeater ID="rpRatesheetDetails" runat="server"
onitemcommand="rpRatesheetDetails_ItemCommand"
onitemdatabound="rpRatesheetDetails_ItemDataBound">
<HeaderTemplate>
<tr>
<td width="110" height="25px" class="content">
<table cellpadding="0" cellspacing="1">
<tr>
<td style="cursor:pointer;" runat="server" onclick="toggle();">
Carrier
</td>
<td align="right">
<asp:ImageButton ID="btnCarrierSortAsc" runat="server" ImageUrl="~/Images/Arrow_T.png" ToolTip="Sort Ascending Order" style="display:none;"
CommandName="SortCarrierASC" />
</td>
<td align="right">
<asp:ImageButton ID="btnCarrierSortDsc" runat="server" ImageUrl="~/Images/Arrow_B.png" ToolTip="Sort Descending Order" style="display:none;"
CommandName="SortCarrierDESC" />
</td>
</tr>
</table>
</td>
<td width="110" class="content">
<table cellpadding="0" cellspacing="1">
<tr>
<td>
Date
</td>
<td align="right">
<asp:ImageButton ID="btnDateSortAsc" runat="server" ImageUrl="~/Images/Arrow_T.png" ToolTip="Sort Ascending Order" style="display:none;"
CommandName="SortDateASC" />
</td>
<td align="right">
<asp:ImageButton ID="btnDateSortDesc" runat="server" ImageUrl="~/Images/Arrow_B.png" ToolTip="Sort Descending Order" style="display:none;"
CommandName="SortDateDESC" />
</td>
</tr>
</table>
</td>
<td width="82" class="content">
Call Type
</td>
<td width="110" class="content">
Format
</td>
<td width="100" class="content">
<table cellpadding="0" cellspacing="1">
<tr>
<td>
Status
</td>
<td align="right">
<asp:ImageButton ID="btnStatusAsc" runat="server" ImageUrl="~/Images/Arrow_T.png" ToolTip="Sort Ascending Order" style="display:none;"
CommandName="SortStatusASC" />
</td>
<td align="right">
<asp:ImageButton ID="btnStatusDsc" runat="server" ImageUrl="~/Images/Arrow_B.png" ToolTip="Sort Descending Order" style="display:none;"
CommandName="SortStatusDESC" />
</td>
</tr>
</table>
</td>
<td width="70" class="content">
User
</td>
<td width="82" class="content">
File Name
</td>
<td width="110" class="content">
System
</td>
<td width="110" class="content">
<table cellpadding="0" cellspacing="1">
<tr>
<td>
No. Of Days
</td>
<td align="right">
<asp:ImageButton ID="btnDaysAsc" runat="server" ImageUrl="~/Images/Arrow_T.png" ToolTip="Sort Ascending Order"
CommandName="SortNoOfDaysASC" />
<asp:ImageButton ID="btnDaysDsc" runat="server" ImageUrl="~/Images/Arrow_B.png" ToolTip="Sort Descending Order"
CommandName="SortNoOfDaysDESC" />
</td>
</tr>
</table>
</td>
</tr>
</HeaderTemplate>
Above is the header template of my repeater.By default when my repeater loads it is sorted by the last column.Now i want dat if the user want to sort by any other column he should click on dat column.Only den the sort icon will be shown and the records will be sorted.I am showing this icon on the ItemDataBound event but how to fire an ItemDataBound event while clicking on header??

The order of the items in the repeater depends on the order in the bound collection (the DataSource).
Sort the items in the DataSource before binding in order to get a sorted list in your repeater.
Do this in your rpRatesheetDetails_ItemCommand - check the command name, sort the collection accordingly, then bind.

Related

How to add spacing between checkboxlist items?

I have checkboxlist within a table I am using. The checklist I need to line up with checkboxes in the second column. The spacing of each row of the textboxes(second row) is 26px. I can not find how to do spacing between items on checkbox list. Setting margins only does the outside of the list not items within.
I tried cellspacing but I cant get it quite lined up.
Update 2
<td style="vertical-align: top" rowspan="7" Width="175" style="padding: 0;">
<asp:CheckBoxList ID="cbtasklist" runat="server" CssClass="radiobutton">
<asp:ListItem Value="Task 1">Task 1</asp:ListItem>
<asp:ListItem Value="Task 2">Task 2</asp:ListItem>
<asp:ListItem Value="Task 3">Task 3</asp:ListItem>
<asp:ListItem>Task 4</asp:ListItem>
<asp:ListItem Value="Task 5">Task 5</asp:ListItem>
<asp:ListItem Value="Other1">Other</asp:ListItem>
<asp:ListItem Value="Other2">Other</asp:ListItem>
</asp:CheckBoxList>
</td>
<td class="auto-style187" style="vertical-align: top" colspan="2">
</td>
.auto-style187 {
height: 26px;
width: 357px;
}
Update 3:
Would it be easier to do a checkbox for each line so I can use the same CSS as the other column?
The reason for the checkbox list is for validation that 1 must be selected.
I hope you are looking for this
<form id="form1" runat="server">
<div style="width: 100%">
<table class="auto-style1">
<tr>
<td class="auto-style3">
<asp:CheckBoxList ID="CheckBoxList1" runat="server" Height="163px">
<asp:ListItem>a</asp:ListItem>
<asp:ListItem>b</asp:ListItem>
<asp:ListItem>c</asp:ListItem>
<asp:ListItem>d</asp:ListItem>
<asp:ListItem>e</asp:ListItem>
<asp:ListItem>f</asp:ListItem>
</asp:CheckBoxList>
</td>
<td class="auto-style8">
<table class="auto-style1">
<tr>
<td class="auto-style5">
<asp:TextBox ID="TextBox1" runat="server" OnTextChanged="TextBox1_TextChanged"></asp:TextBox>
</td>
<td>aaaa</td>
</tr>
<tr>
<td class="auto-style6">
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</td>
<td class="auto-style7">aaaa</td>
</tr>
<tr>
<td class="auto-style5">
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</td>
<td>aaaa</td>
</tr>
<tr>
<td class="auto-style10">
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
</td>
<td class="auto-style11">aaaa</td>
</tr>
<tr>
<td class="auto-style12">
<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
</td>
<td class="auto-style13">aaaa</td>
</tr>
<tr>
<td class="auto-style5">
<asp:TextBox ID="TextBox6" runat="server" OnTextChanged="TextBox6_TextChanged"></asp:TextBox>
</td>
<td>aaaa</td>
</tr>
</table>
</td>
<td class="auto-style4"></td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td class="auto-style9"> </td>
<td> </td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td class="auto-style9"> </td>
<td> </td>
</tr>
<tr>
<td class="auto-style14"></td>
<td class="auto-style15"></td>
<td class="auto-style11"></td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td class="auto-style9"> </td>
<td> </td>
</tr>
</table>
</div>
</form>
see the image
I just took table inside a table .You can just remove the unwanted column as your desire
don't forget to edit the text box lineup its up to you
why don't you try with this on your CSS:
checkbox { padding-bottom: 10px; }

ASP.NET : Get Label inside Repeater using JQuery based on custom attribute

i read so many solutions and blogs on this but still not able to get it done.
I have a Repeater in my code, which has labels in ItemTemplate. I need to do a client side validation (using jQuery) on the values entered in the TextBox on a button click event. i have some value in my label which I want to access to make comparision between the values entered in the textbox and text of label. Now I added a custom attribute named datakey to the label and textbox both, so that comparision is easy.
I access the text box and get the datakey attribute.
I get the label with the datakey value same as that of textbox and do my comparision.
Now in Jquery I am not able to access that label.
This is what i wrote in Jquery:
var lbl = $("label").find("[datakey='" + expID + "']");
ASP Code.
<table class="tblDispData">
<asp:Repeater ID="PrjBudgetDetails" runat="server" ClientIDMode="Static">
<HeaderTemplate>
<tr>
<th class="thDataDisp">
<asp:Label ID="LbExpType" runat="server" Text="Expenditure Type" CssClass="LbTblDataDisp"
Font-Bold="true"></asp:Label>
</th>
<th class="thDataDisp">
<asp:Label ID="LbAllocatedBudget" runat="server" Text="Allocated Budget" CssClass="LbTblDataDisp"
Font-Bold="true"></asp:Label>
</th>
<th class="thDataDisp">
<asp:Label ID="LbAvailedBudget" runat="server" Text="Available Budget" CssClass="LbTblDataDisp"
Font-Bold="true"></asp:Label>
</th>
<th class="thDataDisp">
<asp:Label ID="LbRequestedBudget" runat="server" Text="Budget Requested" CssClass="LbTblDataDisp"
Font-Bold="true"></asp:Label>
</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td class="tdDataDisp">
<asp:Label ID="ExpTypeText" runat="server" Text='<%#Eval("ExpType") %>' CssClass="LbTblDataDisp"
AssociatedControlID="BudgetRequestedText"></asp:Label>
</td>
<td class="tdDataDisp">
<asp:Label ID="BudgetAllocatedText" runat="server" Text='<%#Eval("BudgetAllocated") %>'
CssClass="LbTblDataDisp" AssociatedControlID="BudgetRequestedText"></asp:Label>
</td>
<td class="tdDataDisp">
<asp:Label ID="BudgetAvailableText" runat="server" dataKey='<%#Eval("ExpID") %>'
Text='<%#Convert.ToDouble(Eval("BudgetAllocated")) - Convert.ToDouble(Eval("BudgetAvailed")) %>'
CssClass="LbTblDataDisp" ClientIDMode="Static" AssociatedControlID="BudgetRequestedText"></asp:Label>
</td>
<td class="tdDataDisp">
<asp:TextBox ID="BudgetRequestedText" runat="server" dataKey='<%#Eval("ExpID") %>'
dataValue='<%#Eval("ExpType") %>' CssClass="tblDataInput"></asp:TextBox>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
<tr>
<td colspan="3">
<span id="Legend1" class="frmInstructions" runat="server">Please enter zero(0) if not
requesting budget for any particular expenditure. The currency is INR. </span>
</td>
<td>
<asp:Button ID="prjBudgetSubmitBtn" runat="server" Text="Submit Budget" CssClass="formNext"
ClientIDMode="Static" OnClick="prjBudgetSubmitBtn_Click" />
</td>
</tr>
</table>
The RESULTING MARKUP HERE
<table class="tblDispData">
<tr>
<th class="thDataDisp">
<span id="LbExpType" class="LbTblDataDisp" style="font-weight:bold;">Expenditure Type</span>
</th>
<th class="thDataDisp">
<span id="LbAllocatedBudget" class="LbTblDataDisp" style="font-weight:bold;">Allocated Budget</span>
</th>
<th class="thDataDisp">
<span id="LbAvailedBudget" class="LbTblDataDisp" style="font-weight:bold;">Available Budget</span>
</th>
<th class="thDataDisp">
<span id="LbRequestedBudget" class="LbTblDataDisp" style="font-weight:bold;">Budget Requested</span>
</th>
</tr>
<tr>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="ExpTypeText" class="LbTblDataDisp">Hardware</label>
</td>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="BudgetAllocatedText" class="LbTblDataDisp">9.00</label>
</td>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="BudgetAvailableText" class="LbTblDataDisp" dataKey="EXP001">7</label>
</td>
<td class="tdDataDisp">
<input name="ctl00$pageMainContent$PrjBudgetDetails$ctl01$BudgetRequestedText" type="text" id="BudgetRequestedText" class="tblDataInput" dataKey="EXP001" dataValue="Hardware" dataAmount="7" />
</td>
</tr>
<tr>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="ExpTypeText" class="LbTblDataDisp">Software</label>
</td>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="BudgetAllocatedText" class="LbTblDataDisp">9.00</label>
</td>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="BudgetAvailableText" class="LbTblDataDisp" dataKey="EXP002">9</label>
</td>
<td class="tdDataDisp">
<input name="ctl00$pageMainContent$PrjBudgetDetails$ctl02$BudgetRequestedText" type="text" id="BudgetRequestedText" class="tblDataInput" dataKey="EXP002" dataValue="Software" dataAmount="9" />
</td>
</tr>
<tr>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="ExpTypeText" class="LbTblDataDisp">Software AMC</label>
</td>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="BudgetAllocatedText" class="LbTblDataDisp">9.00</label>
</td>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="BudgetAvailableText" class="LbTblDataDisp" dataKey="EXP003">9</label>
</td>
<td class="tdDataDisp">
<input name="ctl00$pageMainContent$PrjBudgetDetails$ctl03$BudgetRequestedText" type="text" id="BudgetRequestedText" class="tblDataInput" dataKey="EXP003" dataValue="Software AMC" dataAmount="9" />
</td>
</tr>
<tr>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="ExpTypeText" class="LbTblDataDisp">Hardware AMC</label>
</td>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="BudgetAllocatedText" class="LbTblDataDisp">9.00</label>
</td>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="BudgetAvailableText" class="LbTblDataDisp" dataKey="EXP004">9</label>
</td>
<td class="tdDataDisp">
<input name="ctl00$pageMainContent$PrjBudgetDetails$ctl04$BudgetRequestedText" type="text" id="BudgetRequestedText" class="tblDataInput" dataKey="EXP004" dataValue="Hardware AMC" dataAmount="9" />
</td>
</tr>
<tr>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="ExpTypeText" class="LbTblDataDisp">UPS</label>
</td>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="BudgetAllocatedText" class="LbTblDataDisp">9.00</label>
</td>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="BudgetAvailableText" class="LbTblDataDisp" dataKey="EXP006">9</label>
</td>
<td class="tdDataDisp">
<input name="ctl00$pageMainContent$PrjBudgetDetails$ctl05$BudgetRequestedText" type="text" id="BudgetRequestedText" class="tblDataInput" dataKey="EXP006" dataValue="UPS" dataAmount="9" />
</td>
</tr>
<tr>
<td colspan="3">
<span id="pageMainContent_Legend1" class="frmInstructions">Please enter zero(0) if not
requesting budget for any particular expenditure. The currency is INR. </span>
</td>
<td>
<input type="submit" name="ctl00$pageMainContent$prjBudgetSubmitBtn" value="Submit Budget" id="prjBudgetSubmitBtn" class="formNext" />
</td>
</tr>
</table>
Thanks in advance.
Following code will give you the related label.
$("label[dataKey='" + expID + "']")
Demo

How to code the date calendar?

I have a simple form as you see, the DOB date of birth, field, I would like to have it
with a date picker, how is the best way for this?
tr>
<td>
<dx:ASPxLabel ID="ASPxLabel8" runat="server" Text="DOB:" Width="50px"></dx:ASPxLabel>
</td>
<td align="left">
</td>
<td>
<dx:ASPxTextBox ID="tbDOB" runat="server" Width="100px"></dx:ASPxTextBox>
</td>
<td align="right">
<dx:ASPxLabel ID="ASPxLabel9" runat="server" Text="Weight:" Width="50px"></dx:ASPxLabel>
</td>
<td align="left">
<dx:ASPxTextBox ID="tbWeight" runat="server" Width="100px"></dx:ASPxTextBox>
</td>
<td align="right">
<dx:ASPxLabel ID="ASPxLabel10" runat="server" Text="Height:" Width="50px"></dx:ASPxLabel>
</td>
<td align="left">
<dx:ASPxTextBox ID="tbHeight" runat="server" Width="100px"></dx:ASPxTextBox>
</td>
<td align="right">
<dx:ASPxLabel ID="ASPxLabel11" runat="server" Text="BP:" Width="50px"></dx:ASPxLabel>
</td>
<td align="left">
<dx:ASPxTextBox ID="tbBP" runat="server" Width="100px"></dx:ASPxTextBox>
</td>
<td align="right">
<dx:ASPxLabel ID="ASPxLabel12" runat="server" Text="Pulse:" Width="50px"></dx:ASPxLabel>
</td>
<td align="left">
<dx:ASPxTextBox ID="tbPulse" runat="server" Width="100px" ></dx:ASPxTextBox>
</td>
</tr>
very simple way to do this would be to use Jquery's built in datepicker like this:
<dx:ASPxTextBox ID="tbDOB" runat="server" Width="100px"></dx:ASPxTextBox>
and In the script tag:
<script language="javascript" type="text/javascript">
$(document).ready(function(){
$("#tbDOB").datepicker();
});
</script>
DEMO: http://jsfiddle.net/WzLc3/3/
ALSO:
If you cannot use Jquery for your application, you can do this purely through asp.net but lightly more complicated by using the calander contorl.
here is a great tutorial for beginners to walk you through the steps,
http://www.dotnetfunda.com/articles/article746-how-to-create-a-date-picker-in-aspnet.aspx

ASP.NET button event not firing when using modelpopupextender

I have one Panel that is linked to a ModelPopupExtenderand there is a button inside the first panel. When I click the first panel's button I want it to execute the event and inside this event I want to pop up the second Panel which is also linked to a ModelPopupExtender, but when I click the first Panel's button the event does not trigger.
Asp Code :
<input type="hidden" runat="server" id="hdnEditBank1" />
<asp:Panel runat="server" ID="pnl1" CssClass="Modal450h450w" Height="300px">
<table id="tblEditBank1" runat="server">
<tr>
<td> </td>
<td> </td>
<td> </td>
<td align="right" colspan="2"><img runat="server" id="imgExitEdit1" src="../images/Exit_cross.png" /></td>
</tr>
<tr>
<td colspan="3">Name : </td>
<td colspan="2"><telerik:RadTextBox ID="txt1" runat="server" CssClass="largebox"></telerik:RadTextBox></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td colspan="4">
<asp:Button runat="server" ID="btnClose" Text="Close" OnClick="btnAdd_Close_Click" />
</td>
<td align="right">
<asp:Button runat="server" ID="btnNext" Text="Next" OnClick="btnEdit_Next_Click" />
</td>
</tr>
</table>
</asp:Panel>
<!-- second panel -->
<asp:ModalPopupExtender ID="ModalPopupExtender6" runat="server" TargetControlID="btnNext" OkControlID="imgExitEdit1"
PopupControlID="pnl2" BackgroundCssClass="LoadingBackground" >
</asp:ModalPopupExtender>
<input type="hidden" runat="server" id="Hidden1" />
<asp:Panel runat="server" ID="pnl2" CssClass="Modal450h450w" Height="300px">
<table id="Table1" runat="server">
<tr>
<td> </td>
<td> </td>
<td> </td>
<td align="right" colspan="2"><img runat="server" id="img1" src="../images/Exit_cross.png" /></td>
</tr>
<tr>
<td colspan="3">Some Label : </td>
<td colspan="3"><telerik:RadTextBox ID="txtSomeText" runat="server" CssClass="largebox"></telerik:RadTextBox></td>
</tr>
<tr>
<td colspan="4">
<asp:Button runat="server" ID="btnIbanClose" Text="Close" OnClick="btnAdd_Close_Click" />
</td>
<td align="right">
<asp:Button runat="server" ID="btnIbanReview" Text="Next" OnClick="btnEdit_Next_Click" />
</td>
</tr>
</table>
</asp:Panel>
The code behind :
protected void btnEdit_Next_Click(object sender, EventArgs e)
{
ModalPopupExtender6.Show();
}
I am thinking it's about the AutoPostBack but I am not sure how to resolve this
I have found the solution to this if anybody is interested.
What you need to do is create a hidden input field and set the TargetControlID to the hidden control and from there you are able to fire off the buttons event.
<input type="hidden" runat="server" id="hdnNext" />
<asp:ModalPopupExtender ID="ModalPopupExtender6" runat="server" TargetControlID="hdnNext" OkControlID="imgExitEdit1"
PopupControlID="pnlIban" BackgroundCssClass="LoadingBackground" >
</asp:ModalPopupExtender>
The input field is used in this case as a Dummy control where the ModalPopupExtender points to and from the buttons event you are able to control which other ModalPopupExtenders you want to control.

Validation not working for ImageButton click

I have an image button for login in my system. so as the most common thing i m having two text boxes txt_username and txt_password.
i have put required field validator for both the text boxes. and set the validation group "a" and respective control to validate for both of them. the source code for my ImageButton is as follows:-
<td align="right" class="simple_text"> </td>
<td align="left">
<asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="true"
ImageUrl="~/images/signin_button.gif" onclick="ImageButton1_Click"
ValidationGroup="a" />
</td>
now I am fed up as when I run my application and click the ImageButton it doesn't respond to the validation at all and redirects to the next page. Can anyone say why is it so? this is the first time wherein the validators are not working.
this is source code:-
<td align="left"><table width="480" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="178" align="right" class="simple_text">User Name : </td>
<td width="302" align="left">
<asp:TextBox ID="txt_username" runat="server"
CssClass="text_box_username" Width="180px" AutoPostBack="True"
ontextchanged="txt_username_TextChanged" ValidationGroup="a"
CausesValidation="True"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="txt_username" ErrorMessage="RequiredFieldValidator"
ValidationGroup="a">**</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right" class="simple_text"> </td>
<td align="left"> </td>
</tr>
<tr>
<td align="right" class="simple_text">Password : </td>
<td align="left">
<asp:TextBox ID="txt_password" runat="server" CssClass="text_box_password"
TextMode="Password" Width="180px" ValidationGroup="a"
CausesValidation="True"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="txt_password" ErrorMessage="RequiredFieldValidator"
ValidationGroup="a">**</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right" class="simple_text"> </td>
<td align="left"> </td>
</tr>
<tr>
<td align="right" class="simple_text"> </td>
<td align="left">
<asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="true"
ImageUrl="~/images/signin_button.gif" onclick="ImageButton1_Click"
ValidationGroup="a" />
</td>
</tr>
</table></td>
</tr>
<tr>
<td align="left"> </td>
</tr>
<tr>
hi just paste this code will work surely for you
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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>
</head>
<body>
<form id="form1" runat="server">
<div>
<td align="left"><table width="480" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="178" align="right" class="simple_text">User Name : </td>
<td width="302" align="left">
<asp:TextBox ID="txt_username" runat="server"
Width="180px" AutoPostBack="True"
ValidationGroup="a"
CausesValidation="True" ontextchanged="txt_username_TextChanged"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="txt_username" ErrorMessage="RequiredFieldValidator"
ValidationGroup="a">**</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right" class="simple_text"> </td>
<td align="left"> </td>
</tr>
<tr>
<td align="right" class="simple_text">Password : </td>
<td align="left">
<asp:TextBox ID="txt_password" runat="server"
TextMode="Password" Width="180px" ValidationGroup="a"
CausesValidation="True"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="txt_password" ErrorMessage="RequiredFieldValidator"
ValidationGroup="a">**</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right" class="simple_text"> </td>
<td align="left"> </td>
</tr>
<tr>
<td align="right" class="simple_text"> </td>
<td align="left">
<asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="true"
ImageUrl="~/images/signin_button.gif" onclick="ImageButton1_Click"
ValidationGroup="a" />
</td>
</tr>
</table></td>
</tr>
<tr>
<td align="left"> </td>
</tr>
<tr>
</div>
</form>
</body>
</html>
Hope you provided the validationGroup property properly.
Specifying Validation Groups
How about this:
<asp:ImageButton runat="server" CausesValidation="true" ImageUrl="..." />
CausesValidation="true" might force the validation to run.

Categories