Click here to Skip to main content
15,889,315 members
Home / Discussions / JavaScript
   

JavaScript

 
GeneralRe: Use getElementById without request to server Pin
Ali Al Omairi(Abu AlHassan)11-Apr-12 6:01
professionalAli Al Omairi(Abu AlHassan)11-Apr-12 6:01 
GeneralRe: Use getElementById without request to server Pin
RichardGrimmer11-Apr-12 21:30
RichardGrimmer11-Apr-12 21:30 
GeneralRe: Use getElementById without request to server Pin
Ali Al Omairi(Abu AlHassan)12-Apr-12 5:19
professionalAli Al Omairi(Abu AlHassan)12-Apr-12 5:19 
AnswerRe: Use getElementById without request to server Pin
Angel13209-Apr-12 20:53
Angel13209-Apr-12 20:53 
QuestionJavascript Pin
Manikandan H4-Apr-12 21:02
Manikandan H4-Apr-12 21:02 
AnswerRe: Javascript Pin
ZurdoDev12-Apr-12 8:58
professionalZurdoDev12-Apr-12 8:58 
QuestionHow to find the row in the gridview that was selected Pin
MacIntyre4-Apr-12 13:24
MacIntyre4-Apr-12 13:24 
AnswerRe: How to find the row in the gridview that was selected Pin
Angel13209-Apr-12 20:52
Angel13209-Apr-12 20:52 
Try using this Example :

<%@ Page language="C#" %>




void CustomersGridView_SelectedIndexChanged(Object sender, EventArgs e)
{

// Get the currently selected row using the SelectedRow property.
GridViewRow row = CustomersGridView.SelectedRow;

// Display the company name from the selected row.
// In this example, the third column (index 2) contains
// the company name.
MessageLabel.Text = "You selected " + row.Cells[2].Text + ".";

}

void CustomersGridView_SelectedIndexChanging(Object sender, GridViewSelectEventArgs e)
{

// Get the currently selected row. Because the SelectedIndexChanging event
// occurs before the select operation in the GridView control, the
// SelectedRow property cannot be used. Instead, use the Rows collection
// and the NewSelectedIndex property of the e argument passed to this
// event handler.
GridViewRow row = CustomersGridView.Rows[e.NewSelectedIndex];

// You can cancel the select operation by using the Cancel
// property. For this example, if the user selects a customer with
// the ID "ANATR", the select operation is canceled and an error message
// is displayed.
if (row.Cells[1].Text == "ANATR")
{

e.Cancel = true;
MessageLabel.Text = "You cannot select " + row.Cells[2].Text + ".";

}

}





<title>GridView Select Example




GridView Select Example



<asp:gridview id="CustomersGridView"
="" datasourceid="CustomersSource" autogeneratecolumns="False" autogenerateselectbutton="True" allowpaging="True" selectedindex="1" onselectedindexchanged="CustomersGridView_SelectedIndexChanged" onselectedindexchanging="CustomersGridView_SelectedIndexChanging" runat="server" datakeynames="CustomerID">

<columns>
<asp:boundfield datafield="CustomerID"
="" headertext="CustomerID" insertvisible="False" readonly="True" sortexpression="CustomerID">
<asp:boundfield datafield="FirstName"
="" headertext="FirstName" sortexpression="FirstName">
<asp:boundfield datafield="MiddleName"
="" headertext="MiddleName" sortexpression="MiddleName">
<asp:boundfield datafield="LastName"
="" headertext="LastName" sortexpression="LastName">
<asp:boundfield datafield="Phone"
="" headertext="Phone" sortexpression="Phone">


<selectedrowstyle backcolor="LightCyan"
="" forecolor="DarkBlue" font-bold="true">






<asp:label id="MessageLabel"
="" forecolor="Red" runat="server">





<asp:sqldatasource id="CustomersSource"
="" selectcommand="SELECT CustomerID, FirstName, MiddleName, LastName, Phone FROM SalesLT.Customer" connectionstring="<%$ ConnectionStrings:AdventureWorksLTConnectionString %>" runat="server">




QuestionSenior Software Engineer (PayPal) Pin
jinrunping30-Mar-12 16:19
jinrunping30-Mar-12 16:19 
QuestionNewbie Question Pin
pix_programmer25-Mar-12 19:37
pix_programmer25-Mar-12 19:37 
AnswerRe: Newbie Question Pin
Dalek Dave26-Mar-12 22:34
professionalDalek Dave26-Mar-12 22:34 
GeneralRe: Newbie Question Pin
RichardGrimmer11-Apr-12 5:36
RichardGrimmer11-Apr-12 5:36 
AnswerRe: Newbie Question Pin
Richard MacCutchan27-Mar-12 22:34
mveRichard MacCutchan27-Mar-12 22:34 
GeneralRe: Newbie Question Pin
Benaiah Mischenko24-Apr-12 23:34
Benaiah Mischenko24-Apr-12 23:34 
Questionre-index array. Pin
Ethius23-Mar-12 8:40
Ethius23-Mar-12 8:40 
AnswerRe: re-index array. Pin
Jay Fesco23-Mar-12 10:33
Jay Fesco23-Mar-12 10:33 
GeneralRe: re-index array. Pin
Ethius27-Mar-12 0:58
Ethius27-Mar-12 0:58 
AnswerRe: re-index array. Pin
kingNull26-Mar-12 20:27
kingNull26-Mar-12 20:27 
QuestionHow to separate an array of checkboxes into groups Pin
SilverNightFall15-Mar-12 22:06
SilverNightFall15-Mar-12 22:06 
AnswerRe: How to separate an array of checkboxes into groups Pin
BobJanova15-Mar-12 23:38
BobJanova15-Mar-12 23:38 
AnswerRe: How to separate an array of checkboxes into groups Pin
kingNull19-Mar-12 22:51
kingNull19-Mar-12 22:51 
QuestionAbout JavaScript Pin
Member 873345715-Mar-12 17:36
Member 873345715-Mar-12 17:36 
AnswerRe: About JavaScript Pin
V.15-Mar-12 23:12
professionalV.15-Mar-12 23:12 
GeneralRe: About JavaScript Pin
Manfred Rudolf Bihy15-Mar-12 23:48
professionalManfred Rudolf Bihy15-Mar-12 23:48 
QuestionjQueryUI - droppable Pin
killabyte15-Mar-12 10:23
killabyte15-Mar-12 10:23 

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.