Hi I am using Visual Studio 2005.
i have some problem about web parts connection Zone...In my application I am useing two web zones A,B.A zone consists of a drop down list ,and B zone cosists of a gridView which is being popouated with the selected value from A Zone. Its working Fine ...... & now i am added my application in Declarative catalog & Page catalog.Now i am closing Zone B.its added to page catalog.Now i am clicking page catalog. & added to Web zone B.Its added.But I am choosing drop down value from A, & B zone gridview values are not populated.Because using Interface value is NULL.pl tell me the solution of that problem..........------------------------------I am added my Code:appcode/Tableinfo,cs:------------------------------public interface intertableName{ string strTableName { get;}}------------------------------Web zone A usercontrol:
public partial class Usercontrols_DBInformation : System.Web.UI.UserControl, intertableName{ public string strTableName { get { return ddlTableName.SelectedItem.Text; } }
[ConnectionProvider("Table Name")] public intertableName ProvideTableName() { return this; } protected void Page_Load(object sender, EventArgs e) {
if (!IsPostBack) { Database dbtableinfo = null; DataSet dstableinfo = new DataSet(); DbCommand dbcommtableinfo = null; dbtableinfo = DatabaseFactory.CreateDatabase("DBConn"); string sqlCommtableinfo = "sp_display_tables"; dbcommtableinfo = dbtableinfo.GetStoredProcCommand(sqlCommtableinfo); dstableinfo = (DataSet)dbtableinfo.ExecuteDataSet(dbcommtableinfo); ddlTableName.DataSource = dstableinfo; ddlTableName.DataMember = "Table"; ddlTableName.DataTextField = "name"; ddlTableName.DataValueField = "name"; ddlTableName.DataBind(); ddlTableName.Items.Insert(0, new ListItem("-- Select --", String.Empty));
} }------------------------------.ascx page:<table><tr><td><asp:Label ID="lblTable" AssociatedControlID ="ddlTableName" text="TABLE NAME" runat="server"></asp:Label></td><td><asp:DropDownList ID="ddlTableName" runat="server">
</asp:DropDownList></td></tr><tr><td colspan="2" align="center"><asp:Button id="btnSubmit" Text="Submit" Runat="server" /></td></tr></table>
------------------------------Web zone B usercontrol:
private intertableName _tableName;
[ConnectionConsumer("Table Name")] public void ConsumeTableName(intertableName nametable) { _tableName = nametable; }
private void Page_PreRender() { if (_tableName != null) { if (_tableName.strTableName != "-- Select --") { Database db = null; DataSet dataset = new DataSet(); DbCommand dbCommand = null; db = DatabaseFactory.CreateDatabase("DBConn"); string sqlCommand = "select * from " + _tableName.strTableName; dbCommand = db.GetSqlStringCommand(sqlCommand); dataset = (DataSet)db.ExecuteDataSet(dbCommand); gvTableInformation.DataSource = dataset.Tables[0]; gvTableInformation.DataBind(); lblRecords.Visible = false; } else { lblRecords.Text = "Please select the Table name"; } } }------------------------------.ascx page:<table><tr><td align="center"><asp:Label ID="lblRecords" runat="server" ></asp:Label></td></tr><tr><td><asp:GridView ID="gvTableInformation" runat="server"></asp:GridView></td></tr></table>------------------------------Now ASPX PAGE:<%@ Register TagPrefix="table" TagName="dbinfo" Src="~/Usercontrols/DBInformation.ascx"%><%@ Register TagPrefix="table" TagName="tableinfo" Src="~/Usercontrols/TableDetails.ascx" %><!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 id="Head1" runat="server"> <style type="text/css"> .column { float:left; width:30%; height:200px; margin-right:10px; border:solid 1px black; background-color: white; } .menu { margin:5px 0px; } html { background-color:#eeeeee; } </style> <title>Web Part Display Modes</title></head><body> <form id="form1" runat="server"> <div> <asp:WebPartManager id="WebPartManager1" Runat="server" Personalization-InitialScope="Shared" > <StaticConnections> <asp:WebPartConnection ID="WebPartConnection1" ProviderID="Dbinfo" ConsumerID="Tableinfo" /> </StaticConnections> </asp:WebPartManager>
<asp:Menu id="Menu1" OnMenuItemClick="Menu1_MenuItemClick" Orientation="Horizontal" CssClass="menu" Runat="server"> <Items> <asp:MenuItem Text="Browse" /> <asp:MenuItem Text="Design" /> <asp:MenuItem Text="Edit" /> <asp:MenuItem Text="Catalog" /> </Items> </asp:Menu>
<asp:WebPartZone id="WebPartZone1" CssClass="column" Runat="server"> <ZoneTemplate> <table:dbinfo id="Dbinfo" runat="server" Title="DATABASE INFORMATION" Description="Please Select the Table in Drop down & Hit the button"> </table:dbinfo> </ZoneTemplate> </asp:WebPartZone>
<asp:WebPartZone id="WebPartZone2" CssClass="column" Runat="server"> <ZoneTemplate> <table:tableinfo id="Tableinfo" Title="TABLE INFORMATION" Description="Table's Information" runat="server"> </table:tableinfo> </ZoneTemplate> </asp:WebPartZone> <asp:CatalogZone ID="cz" runat="server" CssClass="column"> <ZoneTemplate> <asp:DeclarativeCatalogPart ID="dcp" runat="server"></asp:DeclarativeCatalogPart> <asp:PageCatalogPart ID="pgp" runat="server" /> </ZoneTemplate> </asp:CatalogZone> <asp:EditorZone ID="ez" runat="server" CssClass="column"> <ZoneTemplate> <asp:AppearanceEditorPart ID="aep" runat="server" /> <asp:LayoutEditorPart ID="lep" runat="server" /> <asp:BehaviorEditorPart id="BehaviorEditorPart1" Runat="server" /> </ZoneTemplate> </asp:EditorZone> </div> </form></body></html>------------------------------ protected void Menu1_MenuItemClick(object sender, MenuEventArgs e) { WebPartManager1.DisplayMode = WebPartManager1.DisplayModes[e.Item.Text]; }------------------------------
pl tell me the solution....