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:
------------------------------
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:
------------------------------
Now ASPX PAGE:
<%@ Register TagPrefix="table" TagName="dbinfo" Src="~/Usercontrols/DBInformation.ascx"%>
<%@ Register TagPrefix="table" TagName="tableinfo" Src="~/Usercontrols/TableDetails.ascx" %>
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
http://www.w3.org/1999/xhtml" >
------------------------------
protected void Menu1_MenuItemClick(object sender, MenuEventArgs e)
{
WebPartManager1.DisplayMode = WebPartManager1.DisplayModes[e.Item.Text];
}
------------------------------
pl tell me the solution....
Replies
Know the answer? Post it — somebody with the same question will find it here.