Decompiler
29 01 2008Comments : No Comments »
Categories : Uncategorized
Only numbers can enter into that Textbox
We can use Regular expression validator for this:
In the validation expression property keep ^\d+$.
<asp:TextBox ID=”TextBox1″ runat=”server” Style=”z-index: 100; left: 259px; position: absolute;
top: 283px” ValidationGroup=”check”></asp:TextBox>
<asp:RegularExpressionValidator ID=”RegularExpressionValidator1″ runat=”server” ControlToValidate=”TextBox1″
ErrorMessage=”Please Enter Only Numbers” Style=”z-index: 101; left: 424px; position: absolute;
top: 285px” ValidationExpression=“^\d+$” ValidationGroup=”check”></asp:RegularExpressionValidator>
When we click a Linkbutton or Image button it must open a pop up window.below is the code for that you can place in any of the button events
string s = “javascript:pop_window=window.open(’popup.aspx’,
'pop_window','width=400,height=400,top=50,left=100');
pop_window.focus()";
Page.ClientScript.RegisterClientScriptBlock
(this.GetType(), "s", s, true);
(*) All fields are mandatory
By using this concept some websites display the star marks for the compulsory fields
while registering to that same process in asp.net we must write the following
code in Page_load event.
if(!Page.IsPostback)
{
page.validate();
}
<asp:DropDownList ID=”ddl_countries” runat=”server” ValidationGroup=”CHECKS” DataSourceID=”SqlDataSource1″ DataTextField=”Country” DataValueField=”country_id” AppendDataBoundItems=”true” Width=”100px”><asp:ListItem Value=”">Select</asp:ListItem></asp:DropDownList>
Hai friends here I am writing the code for creating a Custom validator for Radio button.
Please check it out and try.
Write a javascript function in .aspx page
function ValidateRadiobutton(oSrc, args)
{
if(document.getElementById(”").checked ==
false&&document.getElementById(”") .checked ==false)
{
args.IsValid = false;
}
}
Add custom validator
===============
ClientValidationFunction="ValidateRadiobutton" runat="server"
ErrorMessage=”Select Active/Inactive”
CssClass=”ValidationMessage” ValidationGroup=”status” Font-Bold=”True” ForeColor=”Lime”>
Any doubts mail me at: radhekrsna@gmail.com
Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!