Forms Data Controls :: Displaying Gridview Containing DropDownLists?

Oct 15, 2010

On one of my pages I display a Gridview. This contains a list of questions generated by a SQLDataSource, with a dropdownlist on each row containing the answers for that question. The answer values can be different depending on the question, so I populate them in the RowDataBound event for the gridview, using question information.

As the list of questions is longer than the page I have placed the gridview within a Div which allows me to use scrollbars to navigate the gridview. I also use some methods to preserve the location of the last question answered - so that on answering a question, the gridview does not reset to show the first part of the gridview.

This works fine for IE7, which is what I have been using for the development, and which part of my customer base uses. However, the other part of my customer base uses IE6, which causes a problem.

When an IE6 user attempts to answer some questions, they run into issues. Should they scroll down the gridview, when they select a value from a dropdownlist (Effectively, when they answer a question), there is a postback and all of the visible (i.e. onscreen) dropdownlists appear to be cleared. However, on mousing over any of the dropdownlists, their value is then shown. On using either the scrollbar, or on using the mousewheel to scroll the gridview, all the dropdownlists are 'refreshed' and their values are shown.

At no point does the application appear to lose the data, it is just not showing it until there is a mouseover or the gridview is refreshed. Another odd aspect of this is that this does not apply to the first 5 rows of the Gridview. Any of these can be altered without there being this display issue. Should the gridview be scrolled enough to show some of the first 5 rows and some subsequent rows, only the subsequent rows will have this display issue.

I have tried various things to correct this - originally I called my retrievescrollposition method on the SelectedIndexChanged event of the dropdownlist, but have since moved it to Page_Load as the Else branch of if (!IsPostBack). I tried rebinding the DropDownlist in the SelectedIndexChanged event, but this only helped with the Question I was answering - the display of any other onscreen questions was still affected.

View 1 Replies


Similar Messages:

Forms Data Controls :: Filtering GridView Using Two DropDownLists?

Jun 9, 2010

I want to filter my gridview using two parameters that come from Dropdownlists. I bind these drops with two linq queries and next I would like to filter my gridview with query that has two parameters that comes from selected values from those drops. Everything is inserted in UpdatePanel. Here is my code:

asp:UpdatePanel
ID="UpdatePanel1"
runat="server"
>

[Code]....

I don't know how to get selectedvalues from dropdownlist and pass them to Bind() function which binds grid view

View 3 Replies

Forms Data Controls :: Large DropDownLists In GridView?

Jan 5, 2010

I have a gridview that is currently showing 20 lines per page. Each line has several fields in it, three of which are dropdownlists. These dropdownlists are populated with a SQLDataSource and then the selected value is bound to one of the gridview datalements.

The problem I'm running into is that the page is very slow to load. I believe this is because of the large dropdownlists (and possibly because there are roughly 60 of them, each of which is executing a SQL query to populate the list of available values). The file size that is being transmitted over the web is just over 1.25MB in size, again from the large amounts of data in the dropdownlists.

Is anyone aware of a technique by which I could only execute the query from the SQLDataSources that populate the dropdownlists' available values once and then reuse the results of that query to populate the relevant dropdowns? Ideally I would do this on the client side so it would also limit the amount of text being transmitted to the client browser.

View 7 Replies

Forms Data Controls :: Gridview With Dropdownlists And Label

Jan 27, 2011

I have a gridview with 4 dropdownlists and 1 label in each row. Suppose , text fields of each dropdownlists are a,b,c and value fields are 1,2,3 respectively.

In each row,label text is the sum of value fields of selected text fields of 4 dropdownlist.

For example,If selected text of 4 dropdownlists of a row are-b,a,b,c.

Then the label text of that row will be 8.(value field of b=2,a=1,c=3 , so b+a+b+c=8)

Whenever the selected text of any dropdownlist changes,corresponding label field also will change.

How can we do this in asp.net with C#?

View 9 Replies

Forms Data Controls :: Making Gridview Respond To 2 DropDownLists?

Mar 11, 2010

I have got 2 Drop Down Lists on my Form and 1 GridView. I want GridView to display the data according to selection from the Drop Down Lists.

For Example, One Drop Down List contains Names and other contains Dates. Both the Drop Down Lists can post back. So if i select a name from 1st Drop Down list, the Grid View should show all the results according to that Name. Similarly if i select the Date from the other Drop Down List , the Grid View should show the results according to the dates. But i cant figure out as how to bind Grid View to respond to 2 Drop Down List.

BTW i am binding both the Drop Down Lists and the Grid View to the DataSource Objects, which is getting data from the database.

View 12 Replies

Forms Data Controls :: Disabling A Column Of Dropdownlists In Gridview?

Oct 20, 2010

I am filling a gridview with data.

column 1 is a dropdownlist <ddlGrade>

column 2 is a checkbox <cbxNeverAttended> not visible

column 3 is a textbox <tbxLastDate> not visible

in the 'GridView_RowDataBound'

i determine if a ddlGrade value already exists and if so, make it selected in the dropdownlist

also, if the value of ddlGrade is a "U" I make cbxNeverAttended and tbxLastDate visible

However, if cbxNeverAttended or tbxLastDate are both empty strings (and ddlGrade has the value "U"), I want to disable all instances of ddlGrade in the gridview (essentially forcing the user to enter a value for cbxNeverAttended or tbxLastDate before moving on to enter another ddlGrade).

But I have been unable to figure out a way to accomplish this on the 'Gridview_RowDataBound',

View 1 Replies

Forms Data Controls :: Multiple Dropdownlists Search Show In Gridview?

Jul 6, 2010

hope you guys are doing well! I have a question and no answer yet how to do it. Right now i can have 1 dropdownlist and when i press on my search button its show the result of the query the user ask

but how to do it with two seperates dropdownlist ? isnt it with inner join ? also if the value is null what to do ?

here is my sample little code for a sample search

[Code]....

View 1 Replies

Data Controls :: Populating GridView With Two DropDownLists

Sep 11, 2013

I have two dropdown lists that I am using to filter a gridview.  I gridview is populating based on a query

select [AnnotationNumber],[AnnotationBy],[AnnotationType],[BusinessUnit] as Unit,[ErrorType],[ActualAgencyError],AnnotationComments,[sgkComments],[ActualAgencyError],Cust from vw_GridviewSource where Name = '"+@Name+"' and AnnotationDate = '"+@Stage+"'";
SqlCommand cmd = new SqlCommand(query);
gvSummary.DataSource = GetData(cmd);

The @Name and @Stage variables are the selected values of the dropdownlist. When I start I get the two drop down lists on my webform. When I select the values from the dropdownlists, nothing happens. I get no gridview. I added onselecedindexchange event both dropdownlists and even after both are selected nothing. I debugged the code and found that there is a point where the value is correct, but I still don't see the gridview. I have alsochecked the query associated with the databind and it works perfectly when I check it in SQL. I am enclosing all the code from the aspx.cs and aspx.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Trakker.aspx.cs" Inherits="AnnoTracker.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">

[CODE]..

View 1 Replies

Data Controls :: Reset All DropDownLists In GridView When DropDownList Of First Row Changed

Mar 9, 2013

<asp:DropDownList ID="ddlday" Width="100px" runat="server" CssClass="iselect" Autopostback="True"
AppendDataBoundItems ="true">
<asp:ListItem Text="--Select--" Value="0" />
<asp:ListItem Text="Full" Value="1" Selected="True" />
<asp:ListItem Text="Half" Value="2" />
</asp:DropDownList>

I have a dropdown in gridview. I bind the gridview after not ispostback condition. Now if i select drodown lsit value "Full" from the first row of gridview i need all other rows of dropdown in gridview to be selected "full" programtically and after that if the user wants to change other row dropdown to "half" then he can change it.

View 1 Replies

MVC :: How To Get The Dropdownlists (for UserId And Employee Type) Displaying In My Create View

Jan 20, 2011

I am working on an application that has two tables (amongst others) that are related by a Guid Foreign key. The parent table for this guid key is the aspnet_users table and the child table happens to be my employees table which has amongst other columns EmployeeID, FirstName, LastName, EmployeeType, NationalID etc. ant the referenced UserId column from the parent table. I have managed to get the dropdownlists (for UserId and Employee Type) displaying in my create view but have failed to have it create an employee since the guid value from the Dropdown list for UserId cannot bind when posting the form data. I am using Entity Framework 4 , VS 2010 and .Net 4

View 6 Replies

Forms Data Controls :: Decrypt One Gridview Column Values Before Displaying It In The Gridview?

Mar 8, 2011

I have one filed that is encrypted using Rajindal algorithm and stored in MSSQL db.When I retrieve that column in gridview it's displayed in encrypted. I have the code that decrypts it but the problem is:How can I all loop throw this column values in the gridview and decrypt them all and display it in the gridview decrypted.See my code below:

[Code]....

View 9 Replies

Web Forms :: Changing Index On Dropdownlists Childs Donīt Cause Other Dropdownlists To Reload?

Jan 30, 2011

i have the following code:

[Code]....

3 nested dropdownlists SELECTing from DB. So i select the brand, then i select the model and then i select the product and click on SEARCH button.

But when i select thebrand, and then the model, and if i want to change the brand, it does not reset the second and third dropdownlists.

View 3 Replies

Forms Data Controls :: Displaying ArrayList In GridView (vb.net)?

Feb 9, 2011

I've been trying to bound an arraylist to a grdview for display and managed to work out the following:

[Code]....

At the point where rows are added to dt, i'm trying to get arraylist (Tweet) to be read row by row to insert each of it's fields into dt. There is no error but when run in browser, each cell of the gridview shows 'DataExtraction.Tweet'.I'm not sure where to go from here.

View 3 Replies

Forms Data Controls :: Gridview Displaying Results Twice?

Jan 18, 2010

see the below code. just sample page.

<body>
<form
id="form1"
runat="server">
<div>
<asp:GridView
ID="press_dl"
runat="server"
AutoGenerateColumns="False"
PageSize="1"
ShowHeader="False">
<Columns><asp:TemplateField><ItemTemplate>
test head
test shortnews
</ItemTemplate>
<HeaderTemplate>
</HeaderTemplate>
</asp:TemplateField></Columns>
</asp:GridView>
</div>
</form>
</body>
Protected
Sub Page_Load(ByVal
sender As
Object,
ByVal e
As System.EventArgs)
Handles
Me.Load
If
Not Page.IsPostBack()
Then
bind_press()
' bind_events()
End
If
End
Sub
Sub bind_press()
ds = Nothing
ds = New DataSet
Dim query
As
String
query = "select top 1 * from tbl_press order by press_id desc"
myConnection.Open()
da = New OleDbDataAdapter(query, myConnection)
da.Fill(ds, "Press")
myConnection.Close()
press_dl.DataSource = ds.Tables("Press")
press_dl.DataBind()
End
Sub
its dislpayes like this
test head test shortnews
test head test shortnews

this gridview displaying twice. i dont know why.

View 18 Replies

Forms Data Controls :: Displaying The Right Values In A GridView?

Mar 13, 2011

Im displaying a Gridview full of data but the column "Country" is displaying the CountryID and I want it to display the Country 'Name'", same with State/Prov and a Status column I have. I've looked around at BoundField Properties and such and can't seem to find where I can configure this. Is it straight within my DataSource? Here's my code:

GridView Code

[Code]....

Here is my DataSource Code

[Code]....

Is it within the SELECT statement of the DataSource where I can need to configure using "Country" not "CountryID"or "Status" not "StatusID"?

View 7 Replies

Forms Data Controls :: Displaying The Value Of Textbox On The Gridview

Dec 2, 2010

I'm having trouble displaying the value of my textbox on the gridview. For example i have a column named Quantity Received which at the moment has no values in it then i have a textbox that would enter value for that said column .

FrameWorks.fwReplenishmentRecWi qtyrec = new FrameWorks.fwReplenishmentRecWi();
qtyrec.QtyReceived = Convert.ToInt32(txtQuantity.Text);

//lst.UpdateQtyReceived(qtyrec);[code].....

View 2 Replies

Forms Data Controls :: Architecture For Displaying In Gridview?

Jul 5, 2010

I have a Business object (Customers) with about 30 fields/attributesNow, I want to display list of Customers in gridview so I fetch them through my object datasourceBut gridview only uses 8 fields/attributes of an object and rest are unused or wasted Do I design sub objects containing only gridview fields ? How do I go about this problem ?

View 4 Replies

Forms Data Controls :: Gridview Not Displaying In Browser?

Oct 20, 2010

As of today my gridview is no longer showing when I run it in my browser. I have made changes to the database recently but the code behind and aspx file remains the same. No errors are coming up. Just the gridview is now blank and it was working perfectly shortly before.

<asp:GridView ID="grdFixtures" runat="server" AutoGenerateColumns="False"
DataSourceID="FixturesDataSource" OnRowCommand="PushMatchID"
DataKeyNames="MatchID">
<Columns>
<asp:ButtonField ButtonType=Button CommandName=StartMatch HeaderText="Match Scoring" Text="Start" />

[Code]....

View 2 Replies

Forms Data Controls :: Displaying A GridView On Page Load?

Jan 29, 2010

I want to insert a record in the gridview and i have designed it as the fig: below shows.

Initially there is no data in the datatable to which the gridview is bound to,so the gridview is not displayed when the page load,ok

I want to ask that is it possible to display Gridview on page load with only the header and the footer?

i.e;the user can see the header names and the textbox and drop down list at the foorter so that they can insert data in the grid?

View 4 Replies

Forms Data Controls :: ListView And GridView Not Displaying Header

Jul 23, 2010

Grid View I added a function and then called it in the following event.

private void ShowNoResultFound(DataTable source, GridView gv)
{
source.Rows.Add(source.NewRow());
gv.DataSource = source;
gv.DataBind();
int columnsCount = gv.Columns.Count;
gv.Rows[0].Cells.Clear();
gv.Rows[0].Cells.Add(new TableCell());
gv.Rows[0].Cells[0].ColumnSpan = columnsCount;
gv.Rows[0].Cells[0].Text = "No Data Found";
}
protected void AppList_Selected(object sender, SqlDataSourceStatusEventArgs e)
{
if (e.AffectedRows == 0 )
{
ShowNoResultFound(AppList, GridView1);
}
}

It displays the following error The type or namespace name 'DataTable' could not be found (are you missing a using directive or an assembly reference?

ListView

Added the following. It shows the message but not the header. Also tried adding ShowHeader="True". It it not allowing it.

...
<EmptyDataTemplate>
Sorry, no data to display.
</EmptyDataTemplate>
</asp:ListView>

View 9 Replies

Forms Data Controls :: Displaying An Empty GridView And Inserting A New Row In It?

Jan 13, 2011

I have a GridView which works perfect when it is not empty. Now when the source is empty I want to show an empty GridView and to be able to insert rows inside.

I have this code for the page_load event:

[Code]....

but I got the following error:

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

[Code]....

View 10 Replies

Forms Data Controls :: Displaying Header When The Gridview Is Empty?

Mar 15, 2011

I have followed this thread

[URL]

and I have tried most solution and still I cant get the right results...I need a simple workable solution. I would like to display the header of a gridivew when it is empty

View 1 Replies

Forms Data Controls :: Sorted Gridview Not Displaying All Rows?

May 18, 2010

I see from google that this is a common problem. I have a SQL server database that contains 26 rows of data. Two columns, the first is PK and an identity column (keys numbered 1 to 26) and the second column is a text field (nchar(10)) containing a letter of the alphabet (A..Z). The letters were inserted randomly to simulate sql being unsorted by default. I have a query that returns all of the data ordered by the letter column ascending. If I execute the query in sql server I get 26 rows orderd A..Z.

I have a gridview that is set up for paging (page size = 15) and sorting. When sorting is disabled, all data is correctly displayed on the gridview, 15 rows on the first page, 11 rows on the second page.

If I enable sorting, I get 15 rows on the first page and 11 rows on the second page, however on closer examination I find two letters missing and two letters duplicated on both pages. If I navigate to page two, then back to page 1 I find that the data is then shown correctly and the missing letters are back.

Has anyone struck this issue? I am thinking that the sort is not being initialized correctly, but am not sure where to look.

View 2 Replies

Forms Data Controls :: Displaying Selected Value Fom DropDownList In GridView?

Apr 28, 2010

I want to display a GridView using the the selected DataValueField from the DropdownList.

I've set the Selectparameters for the GridView DataSource.

Here is my question: on clicking "BtnSelect" - How do I assign this parameter (@Id) to selected value (DataValueField) from the DropDownList and re-display the grid view accordingly?

Here is what I got so far:

[Code]....

View 5 Replies

Forms Data Controls :: GridView Not Displaying Sorted Output?

Mar 1, 2010

I am building a SortedList object for use as the DataSource of a GridView control. The key-value pairs are being built manually with the "key" fields being inserted in already sorted order. The "key" column is invisible with the "value" column the single displayed data item. I set the DataSource property of the gridview to the sortedlist and call the Bind method. The gridview then displays the data in random fashion!

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved