Problem in GridView Row Selection without using Select button

Hi All,

I want to Select a Gridview Row without using Select button, So i have used following Javascript in Row DataBound Event....

e.Row.Attributes["onmousedown"] = ClientScript.GetPostBackClientHyperlink(this.grdDocs, "Select$" + e.Row.RowIndex,false);

It is working fine. But the page is refreshing every time when i select a row. how can i avoid that....?

0
Shailu
3/5/2009 1:27:18 PM
asp.net.client-side 24353 articles. 1 followers. Follow

6 Replies
1109 Views

Similar Articles

[PageSpeed] 42

Using an UpdatePanel is one option, off the top of my head,


C# <---> VB.Net Translator
0
MetalAsp
3/5/2009 1:36:08 PM

I am not using Ajax here. Can't i do with Javascript...?

0
Shailu
3/5/2009 1:41:50 PM

Row selection in a Grid is only handled server-side also ClientScript.GetPostBackClientHyperlink forces a PostBack. What are you actually trying to do in the mousedown event? If it is actually selecting the Grid row, you're out of luck. That is the only way. If it is just changing the row's color or some such, there are other ways, such as:

e.Row.Attributes.Add("onmouseover", "oldColor = this.style.backgroundColor; this.style.backgroundColor = 'Green';");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor = oldColor;");

NC...

0
NC01
3/5/2009 1:42:27 PM

Actually i am trying to Select the Gridview Row in the "onmousedown" event. Is there any way to use pure JavaScript for this issue.

0
Shailu
3/6/2009 9:46:20 AM

Shailu@Asp:

Actually i am trying to Select the Gridview Row in the "onmousedown" event. Is there any way to use pure JavaScript for this issue.

Like I've already told you, no since GridView row selection is a server-side event.

NC...

 

0
NC01
3/6/2009 12:45:50 PM

Shailu@Asp:

I am not using Ajax here. Can't i do with Javascript...?

 

NO


SHASHANK BHIDE
CAPGEMINI INDIA
"THE ROAD TO SUCCESS IS ALWAYS UNDER CONSTRUCTION MARK MY RESPONSE AS ANSWER TO HELP ME BUILD IT :)"
0
shashankgwl
3/7/2009 4:42:00 AM
Reply:

Similar Artilces:

Select a gridview row without a select button
Hi Does anyone have a vb code sample of how to select a gridview row without having to click on a select button?   Thanks    ASPX <asp:label id="Label1" runat="server" /> <asp:gridview id="GridView1" runat="server" autogeneratecolumns="False" datakeynames="ProductID,ProductName" datasourceid="SqlDataSource1" style="margin-top: 12px;"> <columns> <asp:boundfield datafield="ProductID" headertext="ProductID" readonly="True" sort...

Iwant to select a row and column in gridview with select radiobutton. but No checked change event.below put a button .if click that button to seleced row values will select
I want to select a row and column in gridview using radiobutton in gridview . if which radio button is select that row will select and i want that row column values in outside individual textboxes of next page.  but in that only single radiobutton will select and no post back="true" bcz iam not using checked change property. i inserted button below gridview. if i click the that selected row and columns values are stored into textboxes of next page im using this code .but im getting one column in that row. but i want all columns in that selected row so plz repla...

Select multiple rows in GridView without using a Select Command ?
Hello, Does anyone knows a way to select multiple rows in GridView without using a Select command, control button or a checkbox control? Thank you very much. olaamigos:Does anyone knows a way to select multiple rows in GridView without using a Select command, control button or a checkbox control?  I believe that this is what you are looking for:GridView Clickable Rows Regards,Vinz"Code, Beer and Music" that's my way of being a programmer!How to get your Forum Question Answered | Blog | CodeASP.NET Thanks Vinz for replying, The  sample in the "GridView Cl...

Problem in Using DropDownList Control to select a selected row of SqlDataSource that is under GridView Control
Hi all,In my SQL Server Management Studio Express, I have a database "ChemDatabase" that has a table "LabData"  formatted in the following way: SampleID int PRIMARY KEY, SampleName nvarchar(25), ChemicalName, nvarchar(25), Concentration decimal(6.2) with 5 rows of records in this .dbo table. In my Visual Web Developer Express, I created a website "RPD-TCE" for extracting a row of record from the LabData table by using a DropDownList, a GridView and a SqlDataSource.  I want to click DropDownList to list one number of S...

how to update a row using a seperate update button not command button without selecting the row?
How to update a row using a seperate update button not command button without selecting a row? Simple question but dificult to do. The reason I ask this is that when a user clicks 'Update' I want each row to update the database. Please note I can't use findcontrol as their are no headers This is my code so far: protected void UpdateButton_Click(object sender, EventArgs e){    foreach (GridViewRow row in CellGridView.Rows)     {          string stext = CellGridView.Rows.ToString();     &nb...

How do I select a row using a button that isnt the select command button
I have an 'UP' and 'DOWN' button by the side of a gridview. When i click 'UP' or 'DOWN' the row swaps places with the row above or below which is correct. However i want the row that moved to continue being selected so that i can keep pressing the 'UP' button to move the row rather than having to select the row click 'UP' then select the row then click 'UP' and so on. I need a line of code that changes the selected index up or down when i press the 'UP' or 'DOWN' button. But the events available to me when clicking on...

How to select a row without select button
Hi. I am use one Dataview in My Web site Now i Have 2 boubts , 1.How to get a Datagrid item values(All row values)in pageLoad event 2.How to select a row without using Select Button, i want to select a row on mouse click event Please give me a soulation TO SELECT A ROW ONCLICK: Firstly, you will need to enable row selections for your datagrid. this will place the proper javascript in your page for what is to come.  This will place a select button on your page, but you can convert that column into a template and make the linkbutton visible=false. you need a OnRowCreated ev...

Gridview paging enabled. Has checkbox to select the row . If user select the checkbox on one page and move to 2nd page to select the rows there also to export the selected rows to excel. But doing so
HiI am using Gridview and that has paging enabled. Using checkbox to select the particular row of the gridview to export the selected rows to the excel . Everything is working fine except for one case.Let user selected the "check" box for, five rows which user would like to export to excel (two of rows on page 1 of results and 3 of them on page 2 of results), however it only exports the 3 row details from page 2, because it seems to de-select the 2 rows from page 1 when I move to page 2 and vice versa. The code i am using is as :protected void BtnExcel_Click(object sender, EventArg...

Problem with modalpopupextender and gridview select with no select button
I am trying to utilize a gridview configured to use a row select with no select button. protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { // Add the javascript that will do the callback when a user clicks on a row // Header and footer rows should not have callbacksif (e.Row.RowType == DataControlRowType.DataRow) {e.Row.Attributes.Add("onmouseover", "Highlight_On(this);"); e.Row.Attributes.Add("onmouseout", "Highlight_Off(this);");e.Row.Style["cursor"] = "hand";e.Row.Attributes["onclick"...

Selecting records in GRIDVIEW without SELECT button ??
Hi , i was wondering, how to make the SELECT link button that comes along with the GRIDVIEW when we enable SELECTION , disappear and make the records selectable ?, so that insted of CLICKING on the SELECT button for selecting the records , i could directly select the records !. Now i get somthing like this.. for selection.. Col 1   COL2Select nameSelect AgeSelect salary What i want is..this for selection... COL1nameagesalary Thanks in advance ! Convert your data column to a template field. Replace the label with a LinkButton, bind the text and set the commandname o...

Selectable Row in a DataGrid without the SELECT button
Does anyone know how to code the DataGrid so that when click on the data row, that row  must be selected just like a SELECT button does, but without the button?   Thanks, Check this out: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwebteam/html/webteam11062001.asp (Section: The Works and Days of Hands)Remove "_no_spam" for sending email...

Selecting a gridview row and keeping the last selected row in a gridview highlighted after mouse moves over a new row.
What is the best way to show a gridview row highlighted once selected and keep it highlighted once the mouse moves over a different row? Thanks, Steve hi,you can use <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="#FFFFFF" /> plz let me know if i misunderstood you Thanks for your help. One problem; however, is that after the row has been selected and I check the "grid.SelectedIndex" it has a value of -1 and not the index of the row that was selected on the grid. What do you recommend? Thanks, Steve hi, sorry i din...

how can i select a row in a gridview without the select link
how can i select a row in a gridview without the select link, i mean, by click in the row no in the select link?i know that it is not a custom control but i couldnt do that yet. Hi, it is a custom control. ;-) Please see my blog post: Developing a row-clickable GridViewhttp://aspadvice.com/blogs/joteke/archive/2006/01/07/14576.aspxThanks,Teemu KeiskiFinland, EU...

Help selecting geridview row without select button.
I am trying to get a gridview row to be selected without havigna select button.  I have looked all over and come up with this notion.  In the Gridview I do the following.                  <asp:TemplateField HeaderText="ContactID" Visible="False">                    <ItemTemplate>                &n...

Web resources about - Problem in GridView Row Selection without using Select button - asp.net.client-side

Selection - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Cricket: ACT Comets selection trial unearths young talent pushing for Futures League spots
... Creek Molonglo fast bowler Joe Slater (3-31) also stood up, catching the attention of Comets senior coach Kyle Piper. "Each of the selection ...

Tim Bosma murder trial to start Monday with jury selection
The trial of two men accused in the death of Tim Bosma is set to begin Monday with jury selection, which is expected to last up to two weeks. ...

Jeff Long no longer chair of College Football Playoff Selection Committee
Arkansas athletic director Jeff Long's tenure as chairman of the College Football Playoff Selection Committee will end after two seasons.

Jury selection set in fatal 2014 Bourbon Street gunfight - Fox News
A trial is scheduled to begin in New Orleans for the only person arrested following a 2014 gunfight on Bourbon Street that left a bystander dead ...

Jury Selection Starts in Prison Contraband Drone Case
Jury selection is underway for the trial of a Maryland man accused of planning to use a drone to fly drugs, tobacco and pornography into a maximum-security ...

Rashida Jones Sings & Stars In Boss Selection's 'Flip & Rewind' Music Video
... executive producer Jo Miller of Full Frontal . Rashida recently teamed up with her nephew Sunny Levine for his brand new project Boss Selection ...

Today’s selection of articles from Kotaku’s reader-run community: How I Learned to Stop Worrying and
Today’s selection of articles from Kotaku ’s reader-run community: How I Learned to Stop Worrying and Love Warcraft Lore - Orgrim Doomhammer ...

2015 National Film Registry Selections
The Library of Congress named this year’s National Film Registry selections today . As usual, it combined some big-budget movies people love ...

DDCA Official Asked For Sexual Favours in Return of Selection: Arvind Kejriwal
Home Top news Nation World States Telangana Andhra Pradesh Karnataka Kerala Tamil Nadu Odisha Cities Bengaluru Chennai Kochi Thiruvananthapuram ...

Resources last updated: 1/21/2016 6:11:31 AM