Pages

Tuesday, March 6, 2012

Compare Validator for performing date validation


<asp:CompareValidator ID="CompareValidatorBookingDeadline" runat="server"
ControlToCompare="TextBoxTodayDate"
ControlToValidate="TextBoxExpiaryDate" Display="Dynamic"
ErrorMessage="Please check the date."
Operator="LessThanEqual"
Type="Date" 
ValueToCompare="<%= TextBoxSeminarDate.Text.ToShortString() %>">*</asp:CompareValidator>
The important thing is "ValueToCompare" property of the compare validator.

Saturday, March 3, 2012

Getting selected value from drop down using java script in asp.net



<asp:DropDownList ID="dropDown" runat="Server">

                                        <asp:ListItem Text="Item 1" Value="1" Selected="True"></asp:ListItem>

                                        <asp:ListItem Text="Item 2" Value="2"></asp:ListItem>

                                        <asp:ListItem Text="Item 3" Value="3"></asp:ListItem>

                                    </asp:DropDownList>

                                </td>

                                <td>

                                    <input type="button" value="Submit" onclick="GetDropDownValue('<%= dropDown.ClientID %>')" />




// Get DropDown value function GetDropDownValue(id) { alert(document.getElementById(id).value); }

Thursday, February 23, 2012

Math.Round() in java script

Syntax:
Math.round(x)


Example

<script type="text/javascript">

document.write(Math.round(0.75) + "<br />");
document.write(Math.round(0.50) + "<br />");
document.write(Math.round(0.25) + "<br />");
document.write(Math.round(-4.30) + "<br />");
document.write(Math.round(-4.88));

</script>


OUTPUT:


1
1
0
-4
-5

Wednesday, February 22, 2012

How to set default active view index

For making any default active view index . just write folloeing code in code behind

 WayBillMultiView.ActiveViewIndex = 0;

Tuesday, February 21, 2012

how to disable tabindex on controls in asp.net

For disabling tab just set TabIndex of any control to -1.

ex.

 <asp:TextBox ID="tbTotalAmount" runat="server" TabIndex="-1" ></asp:TextBox>