WebControls.Toolbar control is being weird

G

Guest

Ok whats wrong with my toolbar? When I debug I don't get an error message
and the databinding is working correctly but the toolbar itself and the
<iewc:ToolbarDropDownlist /> control isn't showing up all that is returned to
the web page is the buttons text and the contents of the DropDownlist. What
am I doing wrong here? Below is the control I typed in and below that is the
code behind.

<iewc:toolbar id="Toolbar1" runat="server">
<iewc:ToolbarTextBox Width="100px" TabIndex="1"
ID="MName"></iewc:ToolbarTextBox>
<iewc:ToolbarSeparator></iewc:ToolbarSeparator>
<iewc:ToolbarButton Text="Add" ID="Add"
TabIndex="2"></iewc:ToolbarButton>
<iewc:ToolbarSeparator></iewc:ToolbarSeparator>
<iewc:ToolbarDropDownList AutoPostBack="True" ID="Select"
runat="server"></iewc:ToolbarDropDownList>
<iewc:ToolbarButton Text="Edit" ID="Edit"></iewc:ToolbarButton>
<iewc:ToolbarButton Text="Delete"
ID="Delete"></iewc:ToolbarButton>
<iewc:ToolbarSeparator></iewc:ToolbarSeparator>
<iewc:ToolbarTextBox ID="SecName"></iewc:ToolbarTextBox>
<iewc:ToolbarButton ID="SecAdd" Text="Add"></iewc:ToolbarButton>
<iewc:ToolbarSeparator></iewc:ToolbarSeparator>
<iewc:ToolbarDropDownList AutoPostBack="True" ID="DDLSection"
runat="server"></iewc:ToolbarDropDownList>
<iewc:ToolbarButton Text="Edit"
ID="EditSec"></iewc:ToolbarButton>
<iewc:ToolbarButton Text="Delete"
ID="DeleteSection"></iewc:ToolbarButton>
</iewc:toolbar>

Codebehind:

protected System.Web.UI.WebControls.DataGrid dgCMS1;

// Instances of the Toolbar control.
protected Microsoft.Web.UI.WebControls.Toolbar Toolbar1;
protected Microsoft.Web.UI.WebControls.ToolbarTextBox MName;
protected Microsoft.Web.UI.WebControls.ToolbarButton Add;
protected Microsoft.Web.UI.WebControls.ToolbarDropDownList Select;
protected Microsoft.Web.UI.WebControls.ToolbarButton Edit;
protected Microsoft.Web.UI.WebControls.ToolbarButton Delete;
protected Microsoft.Web.UI.WebControls.ToolbarTextBox SecName;
protected Microsoft.Web.UI.WebControls.ToolbarButton SecAdd;
protected Microsoft.Web.UI.WebControls.ToolbarDropDownList DDLSection;
protected Microsoft.Web.UI.WebControls.ToolbarButton EditSec;
protected Microsoft.Web.UI.WebControls.ToolbarButton DeleteSection;

// Database connection and access.
protected System.Data.SqlClient.SqlConnection clubconn;
protected System.Data.SqlClient.SqlDataAdapter clubadapt;
protected System.Data.DataSet dsClub;

// DataBase Connection String.
string strclubconn=ConfigurationSettings.AppSettings["ConnectionString"];

private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
BindData();
}
}
public void BindData()
{
string strDDLMenu="SELECT Menu_tbl.* FROM Menu_tbl";
string strDDLSection="SELECT Section_Tbl.* FROM Section_Tbl";
string strDDLSectionData="SELECT SectionData.* FROM SectionData";
string strDDLimg_tbl="SELECT img_tbl.* FROM img_tbl";

clubconn=new SqlConnection(strclubconn);
dsClub=new DataSet();
clubadapt=new SqlDataAdapter(strDDLMenu,clubconn);
clubadapt.Fill(dsClub,"DDLMenu");
clubadapt.SelectCommand=new SqlCommand(strDDLSection,clubconn);
clubadapt.Fill(dsClub,"DDLSection");
clubadapt.SelectCommand=new SqlCommand(strDDLSectionData,clubconn);
clubadapt.Fill(dsClub,"DDLSectionData");
clubadapt.SelectCommand=new SqlCommand(strDDLimg_tbl,clubconn);
clubadapt.Fill(dsClub,"img_tbl");
clubconn.Close();

dsClub.Relations.Add("Menu_Section",
dsClub.Tables["DDLMenu"].Columns["MenuID"],
dsClub.Tables["DDLSection"].Columns["MenuID"],false);
dsClub.Relations[0].Nested=true;

dsClub.Relations.Add("Section_IMG",
dsClub.Tables["DDLSection"].Columns["SectionID"],
dsClub.Tables["img_tbl"].Columns["SectionID"],false);
dsClub.Relations[1].Nested=true;

dsClub.Relations.Add("Section_SectionData",
dsClub.Tables["DDLSection"].Columns["SectionID"],
dsClub.Tables["DDLSectionData"].Columns["SectionID"],false);
dsClub.Relations[1].Nested=true;

Select.DataSource=dsClub;
Select.DataMember="DDLMenu";
Select.DataTextField="MenuName";
Select.DataValueField="MenuID";
Select.DataBind();

DDLSection.DataSource=GetChildRelation(dsClub,"Menu_Section");
DDLSection.DataMember="DDLSection";
DDLSection.DataTextField="SectionTitle";
DDLSection.DataValueField="SectionID";
DDLSection.DataBind();
}
protected DataView GetChildRelation(object dataItem, string relation)
{
DataRowView drv=dataItem as DataRowView;
if(drv != null)
{
return drv.CreateChildView(relation);
}
else
{
return null;
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top