M
Michal Januszczyk
Is it possible to create a control that would have a data
grid embedded, that would have some button columns
causing some action ?
When my grid does not have a button column all works
fine. But when having added it , the browser when loads
the form with the embedded control displays some
javascript error (object required or sth..)
The code for my control is pretty simple:
....
private void Page_Load(object sender, System.EventArgs e)
{
DataSet dsFolderContens = new DataSet();;
dsFolderContens.Tables.Add();
dsFolderContens.Tables[0].Columns.Add("intMailID", typeof
(int));
dsFolderContens.Tables[0].Columns.Add("vstrTitle", typeof
(string));
dsFolderContens.Tables[0].Rows.Add(new object[]
{4,"title"});
dgrFolderContents.DataSource = dsFolderContens;
dgrFolderContents.DataBind();
}
and the control itself:
<form id="form1" runat="server">
<aspataGrid ID="dgrFolderContents" Runat="server"
AutoGenerateColumns="False"
OnItemCommand="CommandHandler" DataKeyField="intMailID">
<Columns>
<asp:ButtonColumn Runat="server"
HeaderText="Title"
DataTextField="vstrTitle"
CommandName="DisplaySelectedMail">
</asp:ButtonColumn>
</Columns>
</aspataGrid>
</form>
The very same code, when being put on web form (without
being wrapped by control) works fine..
Thanks for any suggestions
Michal Januszczyk
grid embedded, that would have some button columns
causing some action ?
When my grid does not have a button column all works
fine. But when having added it , the browser when loads
the form with the embedded control displays some
javascript error (object required or sth..)
The code for my control is pretty simple:
....
private void Page_Load(object sender, System.EventArgs e)
{
DataSet dsFolderContens = new DataSet();;
dsFolderContens.Tables.Add();
dsFolderContens.Tables[0].Columns.Add("intMailID", typeof
(int));
dsFolderContens.Tables[0].Columns.Add("vstrTitle", typeof
(string));
dsFolderContens.Tables[0].Rows.Add(new object[]
{4,"title"});
dgrFolderContents.DataSource = dsFolderContens;
dgrFolderContents.DataBind();
}
and the control itself:
<form id="form1" runat="server">
<aspataGrid ID="dgrFolderContents" Runat="server"
AutoGenerateColumns="False"
OnItemCommand="CommandHandler" DataKeyField="intMailID">
<Columns>
<asp:ButtonColumn Runat="server"
HeaderText="Title"
DataTextField="vstrTitle"
CommandName="DisplaySelectedMail">
</asp:ButtonColumn>
</Columns>
</aspataGrid>
</form>
The very same code, when being put on web form (without
being wrapped by control) works fine..
Thanks for any suggestions
Michal Januszczyk