Friday, 20 July 2012

regular expression validator in asp.net

Follow the link everything is working fine

http://msdn.microsoft.com/en-us/library/ff650303.aspx

regular expression validator in asp.net for phone number

Here the example

<asp:TextBox ID="Phone1" runat="server" Width="90%" Height="30px"></asp:TextBox>

 <asp:RegularExpressionValidator ID="RegularExpressionValidator16" runat="server" ControlToValidate="Phone1"  Display="Dynamic"                                          ValidationExpression="^[+]?\d{9,12}$" ErrorMessage="Invalid"></asp:RegularExpressionValidator>

Thursday, 5 July 2012

Get value from datakeys in gridview

Simple method to get value from datakeys in gridview


LinkButton lb = (LinkButton)e.CommandSource;
GridViewRow gvr = (GridViewRow)lb.NamingContainer;
int id = (int)grid.DataKeys[gvr.RowIndex].Value;

open new window in anchor tag with scroll bar

<a href="#" style="color:White; text-decoration:none;" onclick="javascript:window.open('#','mywindow','width=960,height=700,scrollbars=yes')">Group Article</a>