Click here to Skip to main content
16,013,642 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Life cycle of ASP.Net page Pin
DavidNohejl21-Aug-07 21:56
DavidNohejl21-Aug-07 21:56 
AnswerRe: Life cycle of ASP.Net page Pin
Nouman Bhatti21-Aug-07 23:31
Nouman Bhatti21-Aug-07 23:31 
Questionautomatic installation of mysql db in the local machine Pin
praveenkumar_mca21-Aug-07 20:21
praveenkumar_mca21-Aug-07 20:21 
AnswerRe: automatic installation of mysql db in the local machine Pin
N a v a n e e t h21-Aug-07 21:05
N a v a n e e t h21-Aug-07 21:05 
QuestionCannot Upload from code Pin
abdelhameed8121-Aug-07 20:19
abdelhameed8121-Aug-07 20:19 
AnswerRe: Cannot Upload from code Pin
Goalie3522-Aug-07 3:23
Goalie3522-Aug-07 3:23 
QuestionGridView validation by Javascript Pin
Milind Panchal21-Aug-07 20:12
Milind Panchal21-Aug-07 20:12 
AnswerRe: GridView validation by Javascript Pin
Michael Sync21-Aug-07 21:16
Michael Sync21-Aug-07 21:16 
swami samarth wrote:
I want to validate textbox in gridview for phone number through Javascript only. How can do this


You can add a Custom Validator which points to that textbox in the template column of GridView. then, call the javascript function from GridView.

DEMO

The following code is for Server-side ~

using System;<br />
using System.Data;<br />
using System.Configuration;<br />
using System.Collections;<br />
using System.Web;<br />
using System.Web.Security;<br />
using System.Web.UI;<br />
using System.Web.UI.WebControls;<br />
using System.Web.UI.WebControls.WebParts;<br />
using System.Web.UI.HtmlControls;<br />
using System.Collections.Generic;<br />
<br />
public partial class Default2 :System.Web.UI.Page {<br />
    protected void Page_Load(object sender, EventArgs e)<br />
    {       <br />
        System.Collections.Generic.List<string> s = new List<string>();<br />
        s.Add("Ruby");<br />
        s.Add("Diamond");<br />
        s.Add("Gold");<br />
        GridView1.DataSource = s;<br />
        GridView1.DataBind ();<br />
    }<br />
   <br />
}<br />


I will post the HTML code in next thread. (otherwise, i will lose the formatting here.)

Note: isValidPhoneNumber is a javascript function to check phone number. I set this code ClientValidationFunction="isValidPhoneNumber" ControlToValidate="TextBox1" in custom validator which is put in the template column of GridView. Textbox1 is a textbox which is put in the template column of GridView.





Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)

If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. Smile | :)

GeneralRe: GridView validation by Javascript Pin
Michael Sync21-Aug-07 21:17
Michael Sync21-Aug-07 21:17 
QuestionTabContainer in AjaxControlToolkit Pin
Milind Panchal21-Aug-07 20:08
Milind Panchal21-Aug-07 20:08 
AnswerRe: TabContainer in AjaxControlToolkit Pin
Illegal Operation21-Aug-07 20:38
Illegal Operation21-Aug-07 20:38 
Questionpdf file Pin
yesu prakash21-Aug-07 20:04
yesu prakash21-Aug-07 20:04 
AnswerRe: pdf file Pin
Christian Graus21-Aug-07 20:08
protectorChristian Graus21-Aug-07 20:08 
GeneralRe: pdf file Pin
yesu prakash21-Aug-07 20:11
yesu prakash21-Aug-07 20:11 
GeneralRe: pdf file Pin
N a v a n e e t h21-Aug-07 20:17
N a v a n e e t h21-Aug-07 20:17 
GeneralRe: pdf file Pin
Christian Graus21-Aug-07 20:22
protectorChristian Graus21-Aug-07 20:22 
AnswerRe: pdf file Pin
Vasudevan Deepak Kumar21-Aug-07 21:06
Vasudevan Deepak Kumar21-Aug-07 21:06 
QuestionCalling a method outside of Page_Load is not working [modified] Pin
shivamray21-Aug-07 19:59
shivamray21-Aug-07 19:59 
AnswerRe: Calling a method outside of Page_Load is not working Pin
Christian Graus21-Aug-07 20:06
protectorChristian Graus21-Aug-07 20:06 
GeneralRe: Calling a method outside of Page_Load is not working Pin
shivamray21-Aug-07 20:12
shivamray21-Aug-07 20:12 
GeneralRe: Calling a method outside of Page_Load is not working Pin
N a v a n e e t h21-Aug-07 20:19
N a v a n e e t h21-Aug-07 20:19 
GeneralRe: Calling a method outside of Page_Load is not working Pin
shivamray22-Aug-07 22:30
shivamray22-Aug-07 22:30 
GeneralRe: Calling a method outside of Page_Load is not working Pin
Christian Graus21-Aug-07 20:20
protectorChristian Graus21-Aug-07 20:20 
QuestionCompilation in VWD 2008 Pin
sacheesach21-Aug-07 19:48
sacheesach21-Aug-07 19:48 
AnswerRe: Compilation in VWD 2008 Pin
Illegal Operation21-Aug-07 20:40
Illegal Operation21-Aug-07 20:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.