Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 2005 > Book: Wrox's Visual C# 2005 Express Edition Starter Kit
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Book: Wrox's Visual C# 2005 Express Edition Starter Kit
This is the forum to discuss the Wrox book Wrox's Visual C# 2005 Express Edition Starter Kit by F. Scott Barker; ISBN: 9780764589553
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Book: Wrox's Visual C# 2005 Express Edition Starter Kit section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 14th, 2007, 02:05 AM
Registered User
 
Join Date: May 2007
Location: Mumbai, Maharashtra, India.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Combo box dropped down don't work proper

Hi,

I'm using combo box with keydown event and at any key down i'm using
combo.DroppedDown = true;
but when combo text is empty,its giving exception that "Invalid argument "0". Pls can anybody help me to find out solution.


  #2 (permalink)  
Old May 28th, 2007, 07:08 AM
Registered User
 
Join Date: Apr 2007
Location: Ahmedabad, Gujarat, India.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to sandip.mis Send a message via Yahoo to sandip.mis
Default

using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
    public String ConStr;
    SqlConnection cn;
    SqlCommand cm;
    SqlDataAdapter da;
    DataSet ds = new DataSet();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            CatBind();
                   }
    }
    protected void CatBind()
    {
        ConStr = System.Configuration.ConfigurationManager.AppSetti ngs["constring"].ToString();
        cn = new SqlConnection(ConStr);
        cm=new SqlCommand("select * from Category",cn);
        da = new SqlDataAdapter(cm);
        da.Fill(ds);

        DrpCat.DataValueField = "CatId";
        DrpCat.DataTextField = "CatName";
        DrpCat.DataSource = ds;
        DrpCat.DataBind();
        DrpCat.Items.Insert(0, new ListItem("---Select---", "0"));

    }
    protected void ProBind(string id)
    {
        DrpPro.Items.Clear();
        ConStr = System.Configuration.ConfigurationManager.AppSetti ngs["constring"].ToString();
        cn = new SqlConnection(ConStr);
        cm = new SqlCommand("ProList", cn);
        cm.CommandType = CommandType.StoredProcedure;
        cm.Parameters.Add(new SqlParameter("@proid", SqlDbType.Int, 4, "ProId"));
        cm.Parameters[0].Value = Convert.ToInt32(id);
        da = new SqlDataAdapter(cm);
        da.Fill(ds);
        DrpPro.DataValueField = "ProId";
        DrpPro.DataTextField = "ProName";
        DrpPro.DataSource = ds;
        DrpPro.DataBind();
        DrpPro.Items.Insert(0, new ListItem("---Select---", "0"));

    }
    protected void DrpCat_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (DrpCat.SelectedValue !="0")
        {
            ProBind(DrpCat.SelectedValue.ToString());
        }
    }



ProList Stored Procedure


ALTER PROCEDURE dbo.ProList
    @proid int=5
AS
    if @proid<>0
        begin
            select * from Product where CatId=@proid
        end
        else
        begin
            select * from Information
         end
    RETURN




Sandip
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combo box to display items from parent combo box Gini Visual Studio 2008 0 June 18th, 2008 12:30 AM
Combo box choice creating filtered combo box stevensj5 Access 11 September 13th, 2007 11:33 AM
combo box doesnt work in IE7 but Firefox mamuco Classic ASP Components 1 June 4th, 2007 10:10 AM
Combo box can not work with dynamic Range dahlia492 Excel VBA 1 November 20th, 2006 12:43 PM
Access combo box does not work with SQL Server jerryk Access 3 July 14th, 2006 03:30 PM



All times are GMT -4. The time now is 09:52 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.