I am attempting to create a web form that uses a web service to search a
database. The web form has a dropdownlist that is populated by the
service. I want to be able to select an item from the dropdownlist and
have it refresh the page, still showing the selected item in the
dropdownlist and now showing a datagrid of additional information,
specific to the selection. No datagrid shows until an item is selected
from the dropdownlist.
I am using VS.Net C#, latest production release. I am using a
dropdownlist, a dataview, a dataset, and a datagrid. What I get is the
dropdownlist to populate and I get the complete list of items in the
datagrid. There is no connection between by dropdown and the datagrid.
When I select an item in the dropdown, the page refreshes back to the
original first item in the dropdown list ( I have the AutoPostBack set to
true on the dropdown)
HELP!!
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace SearchClientNXT
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DropDownList
DropDownList1;
protected SearchClientNXT.localhost.dsClaimInfo
dsClaimInfo1;
protected System.Data.DataView DataView1;
protected System.Web.UI.WebControls.DataGrid DataGrid1;
private void Page_Load(object sender, System.EventArgs e)
{
SearchClientNXT.localhost.Service1 ws =
new SearchClientNXT.localhost.Service1();
ws.Credentials =
System.Net.CredentialCache.DefaultCredentials;
dsClaimInfo1.Merge(ws.GetClaim());
//GetClaim method queries DB and returns 2 columns: NUM_CLM and CLMNT
DropDownList1.DataBind();
if (!IsPostBack)
{
DataGrid1.DataBind();
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET
Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dsClaimInfo1 = new
SearchClientNXT.localhost.dsClaimInfo();
this.DataView1 = new System.Data.DataView();
((System.ComponentModel.ISupportInitialize)
(this.dsClaimInfo1)).BeginInit();
((System.ComponentModel.ISupportInitialize)
(this.DataView1)).BeginInit();
//
// dsClaimInfo1
//
this.dsClaimInfo1.DataSetName = "dsClaimInfo";
this.dsClaimInfo1.Locale = new
System.Globalization.CultureInfo("en-US");
this.dsClaimInfo1.Namespace
= "http://www.tempuri.org/dsClaimInfo.xsd";
//
// DataView1
//
this.DataView1.RowFilter = "NUM_CLM like \'%\'";
this.DataView1.Table = this.dsClaimInfo1.LLXCLAMT;
this.Load += new System.EventHandler
(this.Page_Load);
((System.ComponentModel.ISupportInitialize)
(this.dsClaimInfo1)).EndInit();
((System.ComponentModel.ISupportInitialize)
(this.DataView1)).EndInit();
}
#endregion
}
}