Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 13th, 2007, 07:12 AM
Registered User
 
Join Date: Feb 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Binding dropdownlist to gridView

Hi,

hopefully someone can help me because this is driving me crazy!! Bear in mind i'm a complete newbie though......be gentle...

I have populated my dropdown with data from the db (and it executes fine). I am then trying to change the data shown in a gridview based on what has been selected via the dropdown. The error i am getting is ORA-12704:CHARACTER SET MISMATCH. I dont understand what the problem is as when I test the query in the new datasource wizard it returns the expected value. Heres the code:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %>

<!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">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

        <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource1"
            DataTextField="CU_NAME" DataValueField="CU_NAME" Style="z-index: 100; left: 193px;
            position: absolute; top: 118px">
        </asp:DropDownList>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand='SELECT "CU_NAME" FROM "CU_OFFICES"'>
        </asp:SqlDataSource>
        &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="BNP_BANK_CODE"
            DataSourceID="SqlDataSource2" Style="z-index: 102; left: 166px; position: absolute;
            top: 200px">
            <Columns>
                <asp:BoundField DataField="SORT_CODE" HeaderText="SORT_CODE" SortExpression="SORT_CODE" />
                <asp:BoundField DataField="BNP_BANK_CODE" HeaderText="BNP_BANK_CODE" ReadOnly="True"
                    SortExpression="BNP_BANK_CODE" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand='SELECT "SORT_CODE", "BNP_BANK_CODE" FROM "CU_OFFICES" WHERE ("CU_NAME" = :CU_NAME)'>
            <SelectParameters>
                <asp:ControlParameter ControlID="DropDownList1" Name="CU_NAME" PropertyName="SelectedValue"
                    Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
        </div>
    </form>
</body>
</html>





Similar Threads
Thread Thread Starter Forum Replies Last Post
Re-Binding A Dropdownlist In A DetailsView cyber0ne BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 March 26th, 2007 07:10 PM
Binding DropDownList Dynamically knight1907 ASP.NET 2.0 Basics 5 April 4th, 2006 09:01 AM
Newbie Q - DropDownList Binding spuckle ASP.NET 2.0 Basics 1 March 2nd, 2006 12:23 AM
Binding MS Access data to DropDownList aleahy Classic ASP Basics 1 April 25th, 2005 06:02 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.