DropDownList Selected value to set gridview selected Index and page

I have a dropdownlist and a gridview that is bound to the same objectdatasource. In the gridview I am allowing paging.  When user select an item in the dropdownlist list I want to position the gridview selected value to that page and that record. Is there an easy way to do this. I tried this code

Protected Sub GrdMyIssues_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GrdMyIssues.RowDataBound

If e.Row.RowType = DataControlRowType.DataRow Then

'find the position data selected in the

If e.Row.Cells(1).Text = Me.ViewState("IssuesID") Then

e.Row.RowState = DataControlRowState.Selected

GrdMyIssues.SelectedIndex = e.Row.RowIndex

End If

End If

End Sub

It selects the record but it does not position the page in the gridview to the page where the selected row value is.


3/1/2007 9:04:03 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 13


You should add a simple line of code to help you do that :

GridCurrentPageIndex =  (SelecteRowIndex Mod GridPageSize) + 1


Thanks and regards
Pandey, Manish Kumar
"Good judgment comes from experience... and a lot of that comes from bad judgment!" -- Will Rogers
3/1/2007 11:00:36 PM

Similar Artilces:

dropdownlist's selected index value is not printing the selected value
Here iS my code .Aspx Page <asp:DropDownList ID="ddlkeyword" runat="server" Width="204px" DataTextField="Form" DataValueField="Form" OnSelectedIndexChanged="ddlkeyword_SelectedIndexChanged" >   </asp:DropDownList> <asp:Button ID="Button1" runat="server" Text="Submit" Width="110px" OnClick="Button1_Click" /> my aspx.cs protected void Page_Load(object sender, EventArgs e) { fillddlkeyword(); }protected void Page_Init(object sender, EventArgs e) { ...

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...

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...

how can i Fill the controls on web page by selecting value from dropdownlist control.
  Hi,  Currentlly i am working on a web application where i require to fill the web form with the selected item in a text box. for example i have dropdown control named supplier_name, and i want to fill all the other controls values from database on the form when i select name from that supplier_name box,i.e , if i select name1, then related to that name, its code,address ,city should appear on related text boxes. I have done the same in windows application with c# , but the problem with web application(asp.net) is that, when i select Supplier _ it...

Access a DropDownList Selected value in a user control from a content page(nested master page)
 Hi All,I have a DropDownList box in a user control called DDLs.ascx. i have a content page called Sample.aspx which is based on a nested master page. the master pages are called parentMP.master and childMP.master. now i am calling the user control(DDLs.ascx) in the childMP.master like below<%@ Register TagPrefix="ddls" TagName="dropdownboxes" src="~/test/DDLs.ascx" %> now as i said there are 2 Dropdownlist boxes ( ddl1 and ddl2) in this user control.what i want is to access the selected value of these dropdownboxes in the content page and pass them t...

Setting selected value of gridview dropdownlist
Join Date: Jun 2006 Posts: 5 Setting selected value of gridview dropdownlist I have a gridview with a date template column. When the column is in edit mode a dropdownlist is displayed with valid choices for that column. The list is populated in code not using any bound data. My problem is I cant get it to select the fields current value in the dropdownlist when the row is viewed in edit mode. I tried setting the SelectedValue of the dropdown li...

How Select one dropdownlist value using down arrows corresponding other dropdownlist value are select
I am using two dropdownlist box.One is used for country selection. other one is used for state selection.I am using dropdown selectedindexchanged event. when i click country dropdownlist corresponding state is selected in state dropdownlist box. How select the country in country dropdownlist using down arrow keys at the same time corresponding state is select in state dropdown list.R.Karthikeyan   kartmca: How select the country in country dropdownlist using down arrow keys at the same time corresponding state is select in state dropdown list.Generally, we don't implmenet...

Set Selected value from Gridview in page 2 into EditTemplate's Textbox in page 1
Hi All,  I have 2 ASP.NET pages and they have both using Gridview.On page 1, Edit enbale and in the EditTemplate I create a button next to the Textbox when user click,it need to open page 2 (ie, Page 2 serve as a lookup table) and once the user select a row on page I need to set the value let say rows.Cell[1] into the textbox in page 1 and page 2 close itself. I tried to use session but it seem like the session die as soon as page 2 close itself.can someone pls post a script such when user click Select in page 2, I need to set the value for the selected row into the textbox in page 1 ...

DropDownList in Gridview Footer Set Selected Value
I am having a dropdown nightmare! Someone kindly helped me the other day with a very similar problem.Now I have a gridview and I am using the footer row to enter data. When someone clicks the a button outside the gridview the following code executes to show the footer row, which is working, but I also want to pre-select a dropdown with a certain value which is not working.Protected Sub butLinks1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles butLinks1.Click        If GridLinks.ShowFooter = False Then      &n...

Hi all, i am using C# , asp.net vs2005. ajax 1.0 i am populating data programitically . when i select first value, dropdown control select the same. when i select second value ,dropdownlist select second value too But i does not continue  from third value onward . when i select third value, dropdownlist control select second value then after behavior reman the same no matter what i select dropdownlist control select second value ONLY.<asp:DropDownList id="Ddlzse" runat="server" Width="165px" Font-Bold="False" Fo...

Dropdownlist selected value passes first value in list no matter what value is selected. why ?
 HI . I have a dropdownlist. Databinds ok but when I must pass a value as a Selected value it always passes the first value in the list even if I select another value. I tried to set the ddl to enableviewstate false but it doesn't change anything. Any ideas ? Code below, thanksLoading the ddl:       productCategories = CatalogAdmin.Admin_Product_Categories_NotIn(productId);        for (int i = 0; i < productCategories.Rows.Count; i++)        {       &...

Gridview selected index
VS2008 Here is the javescript code on the page: var dialogArgsfunction pageLoad() { fnGetInfo(); }function fnGetInfo() { dialogArgs = dialogArguments;if (dialogArgs.varCustomer == "") { // Empty value do not use. } else {document.getElementById('txtID').value = dialogArgs.varCustomer; // Set the value to blank so it does not get reused on each page reload.dialogArgs.varCustomer = ""; } }function fnSetInfo() { dialogArgs.varCustomer=document.getElementById('txtID').value;if (dialogArgs.varCustomer == "") { // Nothing to re...

How to change the selected index or value of a dropdownlist inside a gridview
 hi guys. no answer found to this issue after previously searching.here goes: in my grid I'm displaying some data and obviously at some point I'm trying to update that data. in the edit item template I've added a dropdownlist with the DataSource='<%# Membership.GetAllUsers() %' and DataTextField="UserName" and the value field the same. in the item template of the same column i have a label used to show the data when the grid view is initially loaded. when I'm entering the edit item template all i want is to set the selected value of the dropdownlist ...

How do I set the selected value of child DropDownList control cascading
 Hello i use ajax with  CascadingDropDown for 2 dropdownlist, one parent and the second chield  for save this informatio in data base is ok, no problem, the question is when i load this information from database to my aspx, i can put the selected value in the dropdownlist parent was very good, but when y tried to put the select value to the chield i have the problem, the razon is that the chield dropdownlist is no load ... how i can load the chiel dropdown for clien side,,  any examples please for example in the proyect http://www.asp.net/learn/ajax-videos/video-278...

Web resources about - DropDownList Selected value to set gridview selected Index and page - asp.net.presentation-controls

Tag Synonyms - Stack Overflow
Q&A for professional and enthusiast programmers

Accidental entities - what about the UI?
This post is a follow-up to my previous blog post " Accidental entities - you don't need that identity ". In that post, we followed a consultant ...

Flash Builder Plug-in for SAP Netweaver Gateway - Adobe Labs
Search Navigation Labs Home Wiki Home Technologies Alchemy Blueprint Camera Profiles and DNG Profile Editor Cirrus ColdFusion 10 DNG Codec Fireworks ...

Air Astana - Join Now
Thank you for considering membership of Nomad Club – Kazakhstan’s first Frequent Flyer Program. You could soon be on your way to earning free ...

Languages -> C# Articles, Tutorials, Examples: ASP Alliance
.NET,ASP,ASP.NET,SQL,XML,HTML,ADO,ADO.NET,JavaScript,JScript,CSharp,VBScript and VB tutorials from AspAlliance.

Blog - Avisra
Avisra Web Development Home Blog Services Contact The Blog Latest Module Builder: How can we make it better? Sitefinity by Chris on July 2, 2013 ...

Online Booking Tool Support
This Online Booking Tool Support page might help you as you navigate through the process of booking travel through your OBT provided by CWT. ...

@Html and beyond
... ); } return string .Format( “{0}{1}” , me.Member.Name, id); } The Html building methods are quite simple. Building a dropdownlist for a ...

Top Ranked Articles
Top Ranked Articles - Free source code and tutorials for Software developers and Architects.; Updated: 23 Feb 2013

Unit Testing DateTime.Now Without Isolation
public virtual void SeedWithYearsSince(DropDownList list, int year){ for (int index = year; index

Resources last updated: 12/8/2015 12:35:32 AM