Advertisement

05.16.2008 at 08:44AM PDT, ID: 23408704
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

GridView Edit mode DropDownLists are acting odd

Tags: ASP.Net
I asked a question about this earlier, and got some response, but it's been over 2 months since anyone last posted, and now the heat is turning up for me to produce something for this project, so I'm hoping someone has some insight.

I have a GridView that is *mostly* working right, except for ONE nagging issue. One of the columns is a TemplateColumn whose ItemTemplate is just a Label that displays the corresponding data from a database. But there are only a limited number of valid values for this column, so to avoid user error, in Edit mode, this is a DropDownList, that will bind to an XML file for the values, then pre-select the value that was held in the Label.

For the longest time, I was unable to make the EditItemTemplate DropDownList bind to the appropriate XML file (that contains the valid values) at all. Thanks to one fo the Experts here, I finally was able to get it partially done, but for some reason, only every other Row is binding the DDL. If this were a DataGrid, I would wonder if the AlternatigRow were the issue, but this is a GridView. All rows are DataRows, there shouldn't be any difference between one row and the next.

To put this clearly, if you run a query and get a set of results, then numbered them, odd-numbered rows will correctly display the DropDownList when you click "Edit". Even-numbered rows will display an empty DropDownList when you click "Edit".

I'm at my wits' end here, and I *really* need to get this project up. To the best of my knowledge, this is the last issue I need to resolve before I can put this web app live. Please help! I am attaching the code-behind for the RowDataBound and RowEditing events, in case something there is at fault. If you need anything else, please let me know. Ideally, I'd love to get this working today, but even otherwise, within the next week would be great.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
protected void gvResult_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.Footer)
        {
            ds = new DataSet();
            ServerPath = Server.MapPath(@"\");
            ds.ReadXml(ServerPath + @"\Library\xml\claimdir\Office.xml");
            DropDownList ddl = (DropDownList)(e.Row.FindControl("ddlNewOfficeUpdate"));
            ddl.DataTextField = "Text";
            ddl.DataValueField = "Value";
            ddl.DataSource = ds.Tables[0];
            ddl.DataBind();
            ddl.Items[0].Text = "-Choose Office-";
        }
        else if (e.Row.RowState == DataControlRowState.Edit)
        {
            ds = new DataSet();
            ServerPath = Server.MapPath(@"\");
            ds.ReadXml(ServerPath + @"\Library\xml\claimdir\Office.xml");
            DropDownList ddl = (DropDownList)e.Row.FindControl("ddlOfficeUpdate");
            ddl.DataTextField = "Text";
            ddl.DataValueField = "Value";
            ddl.DataSource = ds.Tables[0];
            ddl.DataBind();
            ddl.Items[0].Text = "-Choose Office-";
            ddl.SelectedValue = theOffice;
        }
    }
 
    protected void gvResult_RowEditing(object sender, GridViewEditEventArgs e)
    {
        gvResult.EditIndex = e.NewEditIndex;
        theOffice = ((Label)gvResult.Rows[e.NewEditIndex].FindControl("lblOffice")).Text;
    }
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: SeTech
Solution Provided By: raterus
Participating Experts: 1
Solution Grade: A
Views: 10
Translate:
Loading Advertisement...
05.16.2008 at 08:54AM PDT, ID: 21583873

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.16.2008 at 10:33AM PDT, ID: 21584748

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.16.2008 at 10:53AM PDT, ID: 21584943

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.16.2008 at 11:15AM PDT, ID: 21585107

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.16.2008 at 11:41AM PDT, ID: 21585336

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.20.2008 at 07:21AM PDT, ID: 21606384

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.20.2008 at 07:51AM PDT, ID: 21606678

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.20.2008 at 08:12AM PDT, ID: 21606913

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.20.2008 at 08:24AM PDT, ID: 21607055

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.20.2008 at 10:25AM PDT, ID: 21608292

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.20.2008 at 10:56AM PDT, ID: 21608553

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.20.2008 at 12:19PM PDT, ID: 21609388

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.20.2008 at 12:27PM PDT, ID: 21609475

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.20.2008 at 12:43PM PDT, ID: 21609650

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.20.2008 at 01:10PM PDT, ID: 21609891

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.21.2008 at 10:46AM PDT, ID: 21617337

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.21.2008 at 10:59AM PDT, ID: 21617440

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.21.2008 at 11:08AM PDT, ID: 21617496

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.21.2008 at 11:37AM PDT, ID: 21617740

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.21.2008 at 11:54AM PDT, ID: 21617922

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.21.2008 at 12:33PM PDT, ID: 21618266

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.21.2008 at 01:10PM PDT, ID: 21618600

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.21.2008 at 01:18PM PDT, ID: 21618683

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.21.2008 at 01:23PM PDT, ID: 21618728

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.21.2008 at 01:24PM PDT, ID: 21618734

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.21.2008 at 01:31PM PDT, ID: 21618792

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080236-EE-VQP-29 / EE_QW_2_20070628