Click here to Skip to main content
15,894,343 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Security scanner Pin
Eddy Vluggen1-Feb-12 12:43
professionalEddy Vluggen1-Feb-12 12:43 
QuestionProblem creating admin page Pin
pimzy31-Jan-12 22:13
pimzy31-Jan-12 22:13 
AnswerRe: Problem creating admin page Pin
pimzy1-Feb-12 22:15
pimzy1-Feb-12 22:15 
QuestionProblem with custom validator in asp.net Pin
dayakar_dn31-Jan-12 18:05
dayakar_dn31-Jan-12 18:05 
AnswerRe: Problem with custom validator in asp.net Pin
jkirkerx3-Feb-12 16:32
professionaljkirkerx3-Feb-12 16:32 
QuestionBest way to implement Rich Client Application Pin
eng_george131-Jan-12 6:23
professionaleng_george131-Jan-12 6:23 
AnswerRe: Best way to implement Rich Client Application Pin
Dean Oliver31-Jan-12 8:05
Dean Oliver31-Jan-12 8:05 
QuestionDropdown list to populate a gridview Pin
pmcm31-Jan-12 0:54
pmcm31-Jan-12 0:54 
XML
hi - i'm working on an asp.net page that has a DDL and depending on the DDL selection will display a gridview of results. Here's the code I have so far:

Code:
<%@ Page Title="GDNI_SalesmanManager" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="GDNI_SalesmanManager.aspx.cs" Inherits="GDNI_Salesman_Manager.About" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
    <style type="text/css">
        .style1
        {
            width: 251px;
            height: 120px;
        }
    </style>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <h2>
        Customer:
        <asp:DropDownList ID="ddlCustomers" runat="server" Height="17px"
            ToolTip="Customers" Width="285px">
        </asp:DropDownList>
    </h2>
    <p>
        &nbsp;<asp:GridView ID="gvProductClass" runat="server">
        </asp:GridView>
    </p>
</asp:Content>


<pre lang="c#">
using System;
using System.Data;
using System.Configuration;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;


namespace GDNI_Salesman_Manager
{
    public partial class About : System.Web.UI.Page
    {
        string strConnString = ConfigurationManager.ConnectionStrings["BB_Datawarehouse_DB"].ConnectionString;
        string str;
        SqlCommand com;

        protected void Page_Load(object sender, EventArgs e)
        {
            ddlCustomers.AutoPostBack = true;

            if (!IsPostBack)
            Populate_ddlCustomers();
        } //in debug mode the code skips to site.master page load event


        public void Populate_ddlCustomers()
        {
            ddlCustomers.Items.Add("Please Select a Customer");
            SqlConnection con = new SqlConnection(strConnString);
            con.Open();
            str = "exec dbo.sp_GetCustNumAndDSeq";
            com = new SqlCommand(str, con);
            SqlDataReader reader = com.ExecuteReader();
            while (reader.Read())
            {
                ddlCustomers.Items.Add(reader["Customer"].ToString());
            }
            reader.Close();
            reader.Dispose();
        }

        protected void ddlCustomers_SelectedIndexChanged(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(strConnString);
            con.Open();
            str = "exec dbo.sp_GetProductClsCodeAndSalesman '" + ddlCustomers.SelectedItem.Text + "'";
            com = new SqlCommand(str, con);
            SqlDataReader reader = com.ExecuteReader();
            while (reader.Read())
            {
                gvProductClass.DataSource = reader;
                gvProductClass.DataBind();
            }
            reader.Close();
            con.Close();
        }
    }
}


at the minute i'm struggling to get the code to step into the protected void ddlCustomers_SelectedIndexChanged see above comment
AnswerRe: Dropdown list to populate a gridview Pin
pmcm31-Jan-12 1:13
pmcm31-Jan-12 1:13 
Questionasp.net toggle image Pin
disha desani30-Jan-12 21:54
disha desani30-Jan-12 21:54 
SuggestionRe: asp.net toggle image Pin
Rajeev Jayaram30-Jan-12 23:19
Rajeev Jayaram30-Jan-12 23:19 
GeneralRe: asp.net toggle image Pin
disha desani1-Feb-12 18:28
disha desani1-Feb-12 18:28 
AnswerRe: asp.net toggle image Pin
Sankalp Deep1-Feb-12 8:57
Sankalp Deep1-Feb-12 8:57 
GeneralRe: asp.net toggle image Pin
disha desani1-Feb-12 18:25
disha desani1-Feb-12 18:25 
GeneralRe: asp.net toggle image Pin
Satish_S2-Feb-12 2:19
Satish_S2-Feb-12 2:19 
GeneralRe: asp.net toggle image Pin
disha desani2-Feb-12 18:25
disha desani2-Feb-12 18:25 
GeneralRe: asp.net toggle image Pin
disha desani2-Feb-12 18:19
disha desani2-Feb-12 18:19 
GeneralRe: asp.net toggle image Pin
Satish_S5-Feb-12 20:37
Satish_S5-Feb-12 20:37 
QuestionSession expire Pin
Rectus30-Jan-12 7:05
Rectus30-Jan-12 7:05 
AnswerRe: Session expire Pin
Dean Oliver30-Jan-12 7:31
Dean Oliver30-Jan-12 7:31 
QuestionHow can we update row in database table if browser is closed Pin
Member 368287130-Jan-12 2:01
Member 368287130-Jan-12 2:01 
AnswerRe: How can we update row in database table if browser is closed Pin
Not Active30-Jan-12 2:09
mentorNot Active30-Jan-12 2:09 
AnswerRe: How can we update row in database table if browser is closed Pin
RK KL30-Jan-12 5:12
RK KL30-Jan-12 5:12 
AnswerRe: How can we update row in database table if browser is closed Pin
R. Giskard Reventlov30-Jan-12 6:36
R. Giskard Reventlov30-Jan-12 6:36 
AnswerRe: How can we update row in database table if browser is closed Pin
Sankalp Deep1-Feb-12 9:00
Sankalp Deep1-Feb-12 9:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.