Click here to Skip to main content
15,899,313 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Comma with in CSV file Pin
varshavmane7-Sep-07 2:35
varshavmane7-Sep-07 2:35 
AnswerRe: Comma with in CSV file Pin
Chetan Patel7-Sep-07 3:01
Chetan Patel7-Sep-07 3:01 
QuestionGridView Problem Pin
rahuljosh00720006-Sep-07 22:48
rahuljosh00720006-Sep-07 22:48 
AnswerRe: GridView Problem Pin
Sandeep Akhare6-Sep-07 23:35
Sandeep Akhare6-Sep-07 23:35 
AnswerRe: GridView Problem Pin
Chetan Patel7-Sep-07 0:03
Chetan Patel7-Sep-07 0:03 
QuestionMaximum total file size for upload in a form Pin
Yenyen Suwardy6-Sep-07 22:41
Yenyen Suwardy6-Sep-07 22:41 
AnswerRe: Maximum total file size for upload in a form Pin
Sandeep Akhare6-Sep-07 22:59
Sandeep Akhare6-Sep-07 22:59 
QuestionJava Script Related to GridView's Textbox Validation? Pin
sanjay_tutu6-Sep-07 22:23
sanjay_tutu6-Sep-07 22:23 
Dear All,

I have a gridview where first 2 columns are bound fields.
Next 3 columns have template fields with textboxes which are requiered to be filled by user.
i want if user does not provide any value, should be informed then and there through javascript.
I have written one which displays message but focus moves to next field.

I have given my code below.

Please help me.

Thanks;

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>





<title>Untitled Page




<asp:gridview id="GridView1" runat="server" autogeneratecolumns="False" width="552px" cellpadding="4" forecolor="#333333" gridlines="None">
<columns>
<asp:templatefield headertext="SUB_ID">
<itemtemplate>
<asp:textbox id="TextBox1" runat="server" text="<%# Bind("sub_ID") %>">



<asp:templatefield headertext="name">
<itemtemplate>
<asp:textbox id="TextBox2" runat="server" text="<%# Bind("sub_name") %>">



<asp:templatefield headertext="Marks">

<itemtemplate>
<asp:textbox id="TextBox3" runat="server">


<asp:templatefield headertext="Marks-II">
<itemtemplate>
<asp:textbox id="TextBox4" runat="server">


<asp:templatefield headertext="MARKS-III">
<itemtemplate>
<asp:textbox id="TextBox5" runat="server">



<footerstyle backcolor="#507CD1" font-bold="True" forecolor="White">
<rowstyle backcolor="#EFF3FB">
<editrowstyle backcolor="#2461BF">
<selectedrowstyle backcolor="#D1DDF1" font-bold="True" forecolor="#333333">
<pagerstyle backcolor="#2461BF" forecolor="White" horizontalalign="Center">
<headerstyle backcolor="#507CD1" font-bold="True" forecolor="White">
<alternatingrowstyle backcolor="White">

      
<asp:button id="Button1" runat="server" text="Button">






-----------------------------


var gridViewCtlId = '<%=gridview1.ClientID%>';
var gridViewCtl = null;
var curSelRow = null;
var curRowIdx = -1;
function getGridViewControl()
{
if (null == gridViewCtl)
{
gridViewCtl = document.getElementById(gridViewCtlId);

}
}

function onGridViewRowSelected(rowIdx)
{
var selRow = getSelectedRow(rowIdx);
if (null != selRow)
{
curSelRow = selRow;
var cellValue = getCellValue(rowIdx, 0);
alert(cellValue);
}
}

function getSelectedRow(rowIdx)
{
return getGridRow(rowIdx);
}

function getGridRow(rowIdx)
{
getGridViewControl();
if (null != gridViewCtl)
{
return gridViewCtl.rows[rowIdx];
}
return null;
}

function getGridColumn(rowIdx, colIdx)
{
var gridRow = getGridRow(rowIdx);
if (null != gridRow)
{
return gridRow.cells[colIdx];
}
return null;
}

function getCellValue(rowIdx, colIdx)
{

var gridCell = getGridColumn(rowIdx, colIdx);


switch(gridCell.childNodes.item(0).value)
{
case "":
gridCell.childNodes.item(0).focus();
alert("Please enter the value");

break;
return false;

default:
return true;
}

}



--------------------------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load


If Not Page.IsPostBack Then
LoadGridData()
End If


For Each row As GridViewRow In GridView1.Rows
rowIndex = rowIndex + 1
For ctr = 0 To 4

CType(row.FindControl("Textbox" + (ctr + 1).ToString), TextBox).Attributes("onblur") = "javascript: return getCellValue(" + rowIndex.ToString() + "," + ctr.ToString() + ")"

Next
Next

End Sub






sanjay kumar samantaray

QuestionWhere the session data will store Pin
spprofile6-Sep-07 22:17
spprofile6-Sep-07 22:17 
AnswerRe: Where the session data will store Pin
Chetan Patel7-Sep-07 0:05
Chetan Patel7-Sep-07 0:05 
Questionasp.net2.0 Pin
rajmani6-Sep-07 22:15
rajmani6-Sep-07 22:15 
AnswerRe: asp.net2.0 Pin
spprofile6-Sep-07 22:24
spprofile6-Sep-07 22:24 
GeneralRe: asp.net2.0 bin folder create but Pin
rajmani6-Sep-07 22:39
rajmani6-Sep-07 22:39 
GeneralRe: asp.net2.0 bin folder create but Pin
Sandeep Akhare6-Sep-07 23:03
Sandeep Akhare6-Sep-07 23:03 
Questionglobal variable resetting?! Pin
2hdass6-Sep-07 21:57
2hdass6-Sep-07 21:57 
QuestionDatagridview checkbox selection Pin
kvijayajyothy6-Sep-07 21:26
kvijayajyothy6-Sep-07 21:26 
QuestionMCTS Certifictaion Pin
onrivman6-Sep-07 21:17
onrivman6-Sep-07 21:17 
AnswerRe: MCTS Certifictaion Pin
varshavmane6-Sep-07 21:26
varshavmane6-Sep-07 21:26 
GeneralRe: MCTS Certifictaion Pin
onrivman6-Sep-07 21:56
onrivman6-Sep-07 21:56 
GeneralRe: MCTS Certifictaion Pin
varshavmane6-Sep-07 22:46
varshavmane6-Sep-07 22:46 
GeneralRe: MCTS Certifictaion Pin
onrivman10-Sep-07 1:08
onrivman10-Sep-07 1:08 
GeneralRe: MCTS Certifictaion Pin
varshavmane10-Sep-07 3:00
varshavmane10-Sep-07 3:00 
GeneralRe: MCTS Certifictaion Pin
onrivman10-Sep-07 21:48
onrivman10-Sep-07 21:48 
GeneralRe: MCTS Certifictaion Pin
onrivman10-Sep-07 21:48
onrivman10-Sep-07 21:48 
QuestionMCTS Certifictaion Pin
richa02114-Jan-09 20:11
richa02114-Jan-09 20:11 

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.