| Author |
Message |
Kooki
Guest
|
Posted:
Thu Jan 13, 2005 4:55 pm Post subject:
Controls inside the Table Cell |
|
|
Hi!!
I am developing a web part in which I have a table and in the header of a
table I have placed a button. I am not able to track the button click event
or Command event. If I place the same button outside of Table cell then it
works fine but inside the table cell it is not working.
Please help me out.. I shall be very thankful of you for your kind help.
Thanks |
|
| Back to top |
|
 |
Gary A. Bushey [MVP]
Guest
|
Posted:
Thu Jan 13, 2005 5:43 pm Post subject:
Re: Controls inside the Table Cell |
|
|
Are you using HtmlTable, HtmlTableRow, and HtmlTableCell? I have used
these and I get all the proper events. One thing you can do is view source
and look at the code generated for your button to see if it is the same
inside and outside your table.
--
Gary A. Bushey
SPS MVP
bushey@mindspring.com
"Kooki" <Kooki@discussions.microsoft.com> wrote in message
news:077913A7-31CE-4893-9F85-1A026B0AA77F@microsoft.com...
| Quote: | Hi!!
I am developing a web part in which I have a table and in the header of a
table I have placed a button. I am not able to track the button click
event
or Command event. If I place the same button outside of Table cell then it
works fine but inside the table cell it is not working.
Please help me out.. I shall be very thankful of you for your kind help.
Thanks |
|
|
| Back to top |
|
 |
Kooki
Guest
|
Posted:
Thu Jan 13, 2005 5:55 pm Post subject:
Re: Controls inside the Table Cell |
|
|
Dear Gary!!
I am using System.Web.UI.WebControls.Table and
System.Web.UI.WebControls.TableRow and System.Web.UI.WebControls.TableCell.
I have added a control inside the table cell but when I click on it.. it
dont follow the event.
"Gary A. Bushey [MVP]" wrote:
| Quote: | Are you using HtmlTable, HtmlTableRow, and HtmlTableCell? I have used
these and I get all the proper events. One thing you can do is view source
and look at the code generated for your button to see if it is the same
inside and outside your table.
--
Gary A. Bushey
SPS MVP
bushey@mindspring.com
"Kooki" <Kooki@discussions.microsoft.com> wrote in message
news:077913A7-31CE-4893-9F85-1A026B0AA77F@microsoft.com...
Hi!!
I am developing a web part in which I have a table and in the header of a
table I have placed a button. I am not able to track the button click
event
or Command event. If I place the same button outside of Table cell then it
works fine but inside the table cell it is not working.
Please help me out.. I shall be very thankful of you for your kind help.
Thanks
|
|
|
| Back to top |
|
 |
Kooki
Guest
|
Posted:
Thu Jan 13, 2005 6:43 pm Post subject:
Re: Controls inside the Table Cell |
|
|
My full code is as follows:
using System;
using System.ComponentModel;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Xml.Serialization;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.WebPartPages;
using System.Collections.Specialized;
using TablePreFilled;
namespace TableValuesTest
{
public class TableValues : Microsoft.SharePoint.WebPartPages.WebPart
{
Table myTable;
Button newButton;
string Clicked;
string Command;
private void newButton_Command(object sender, CommandEventArgs e)
{
//newButton.Text = "Changed";
Command = e.CommandArgument.ToString();
Clicked = "I am clicked with this Command " + Command;
}
protected override void CreateChildControls()
{
myTable = new Table();
myHtmlTable = new HtmlTable();
myHbutton = new HtmlButton();
newButton = new Button();
newButton.ID = UniqueID;
newButton.Text = "ClickMe!!";
newButton.Command+=new CommandEventHandler(newButton_Command);
this.Controls.Add(myTable);
base.CreateChildControls ();
}
protected override void RenderWebPart(HtmlTextWriter output)
{
TableCell c = new TableCell();
TableRow r = new TableRow();
myTable.Rows.Add(r);
r.Cells.Add(c);
c.Controls.Add(newButton);
EnsureChildControls();
myTable.RenderControl(output);
output.Write("Clicked : "+Clicked + " >" +Command);
}
}
}
Please do tell me where I am making a mistake..
"Amar Galla" wrote:
| Quote: | Hi,
I have definitely used complex table objects and controls without any
problem. Can you paste the full code. Would like to see what exactly is
causing your problem.
Do make sure you add everything to your table, and then add the table object
to the controls array.
--
Hope this helps.
Regards,
Amar Galla
http://www.dotnetjunkies.com/weblog/amar/
"Kooki" <Kooki@discussions.microsoft.com> wrote in message
news:077913A7-31CE-4893-9F85-1A026B0AA77F@microsoft.com...
Hi!!
I am developing a web part in which I have a table and in the header of a
table I have placed a button. I am not able to track the button click
event
or Command event. If I place the same button outside of Table cell then it
works fine but inside the table cell it is not working.
Please help me out.. I shall be very thankful of you for your kind help.
Thanks
|
|
|
| Back to top |
|
 |
Amar Galla
Guest
|
Posted:
Thu Jan 13, 2005 6:49 pm Post subject:
Re: Controls inside the Table Cell |
|
|
Hi,
I have definitely used complex table objects and controls without any
problem. Can you paste the full code. Would like to see what exactly is
causing your problem.
Do make sure you add everything to your table, and then add the table object
to the controls array.
--
Hope this helps.
Regards,
Amar Galla
http://www.dotnetjunkies.com/weblog/amar/
"Kooki" <Kooki@discussions.microsoft.com> wrote in message
news:077913A7-31CE-4893-9F85-1A026B0AA77F@microsoft.com...
| Quote: | Hi!!
I am developing a web part in which I have a table and in the header of a
table I have placed a button. I am not able to track the button click
event
or Command event. If I place the same button outside of Table cell then it
works fine but inside the table cell it is not working.
Please help me out.. I shall be very thankful of you for your kind help.
Thanks |
|
|
| Back to top |
|
 |
Gary A. Bushey [MVP]
Guest
|
Posted:
Thu Jan 13, 2005 10:31 pm Post subject:
Re: Controls inside the Table Cell |
|
|
Try using the HTMLTable and HTMLTableRow (not the correct case). They are
part of System.Web.UI.HtmlControls;
--
Gary A. Bushey
SPS MVP
bushey@mindspring.com
"Kooki" <Kooki@discussions.microsoft.com> wrote in message
news:D79BF4F5-BB42-4A28-8EE1-E28D94DBD56F@microsoft.com...
| Quote: | Dear Gary!!
I am using System.Web.UI.WebControls.Table and
System.Web.UI.WebControls.TableRow and
System.Web.UI.WebControls.TableCell.
I have added a control inside the table cell but when I click on it.. it
dont follow the event.
"Gary A. Bushey [MVP]" wrote:
Are you using HtmlTable, HtmlTableRow, and HtmlTableCell? I have used
these and I get all the proper events. One thing you can do is view
source
and look at the code generated for your button to see if it is the same
inside and outside your table.
--
Gary A. Bushey
SPS MVP
bushey@mindspring.com
"Kooki" <Kooki@discussions.microsoft.com> wrote in message
news:077913A7-31CE-4893-9F85-1A026B0AA77F@microsoft.com...
Hi!!
I am developing a web part in which I have a table and in the header of
a
table I have placed a button. I am not able to track the button click
event
or Command event. If I place the same button outside of Table cell then
it
works fine but inside the table cell it is not working.
Please help me out.. I shall be very thankful of you for your kind
help.
Thanks
|
|
|
| Back to top |
|
 |
Amar Galla
Guest
|
Posted:
Tue Jan 18, 2005 6:40 pm Post subject:
Re: Controls inside the Table Cell |
|
|
Hi,
I did not have much time to see why your version is not working. I feel
that you are adding a different button and table and displaying a different
object. Hence the problem. This is just a wild guess after scanning thru
your code for 5 seconds.
I just deleted chunks which I did not feel necesary and modified a bit
to get u a working code. You can carry on from this stage I guess. Another
thing I would like to say is that, if your target is just to display your
ourput nicely in a table then you do not need to create a table object and
put your controls in it. Just output proper html and render your button at
the correct position. That will do the trick. Enjoy :)
------ Code follows
using System;
using System.ComponentModel;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Serialization;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.WebPartPages;
using System.Collections.Specialized;
namespace TableValuesTest
{
public class TableValues : Microsoft.SharePoint.WebPartPages.WebPart
{
Table myTable;
string Clicked;
string Command;
private void newButton_Command(object sender, CommandEventArgs e)
{
//newButton.Text = "Changed";
Command = e.CommandArgument.ToString();
Clicked = "I am clicked with this Command " + Command;
}
protected override void CreateChildControls()
{
myTable = new Table();
Button newButton = new Button();
newButton = new Button();
newButton.ID = "test";
newButton.Text = "ClickMe!!";
newButton.Command+=new CommandEventHandler(newButton_Command);
TableRow tr = new TableRow();
TableCell tc = new TableCell();
tc.Controls.Add(newButton);
tr.Controls.Add(tc);
myTable.Controls.Add(tr);
this.Controls.Add(myTable);
base.CreateChildControls ();
}
protected override void RenderWebPart(HtmlTextWriter output)
{
EnsureChildControls();
myTable.RenderControl(output);
output.Write("Clicked : "+Clicked + " >" +Command);
}
}
}
--
Hope this helps.
Regards,
Amar Galla
http://www.dotnetjunkies.com/weblog/amar/
"Kooki" <Kooki@discussions.microsoft.com> wrote in message
news:F143FDB7-D623-4A72-B3ED-2EA7DA8969A2@microsoft.com...
| Quote: | My full code is as follows:
using System;
using System.ComponentModel;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Xml.Serialization;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.WebPartPages;
using System.Collections.Specialized;
using TablePreFilled;
namespace TableValuesTest
{
public class TableValues : Microsoft.SharePoint.WebPartPages.WebPart
{
Table myTable;
Button newButton;
string Clicked;
string Command;
private void newButton_Command(object sender, CommandEventArgs e)
{
//newButton.Text = "Changed";
Command = e.CommandArgument.ToString();
Clicked = "I am clicked with this Command " + Command;
}
protected override void CreateChildControls()
{
myTable = new Table();
myHtmlTable = new HtmlTable();
myHbutton = new HtmlButton();
newButton = new Button();
newButton.ID = UniqueID;
newButton.Text = "ClickMe!!";
newButton.Command+=new CommandEventHandler(newButton_Command);
this.Controls.Add(myTable);
base.CreateChildControls ();
}
protected override void RenderWebPart(HtmlTextWriter output)
{
TableCell c = new TableCell();
TableRow r = new TableRow();
myTable.Rows.Add(r);
r.Cells.Add(c);
c.Controls.Add(newButton);
EnsureChildControls();
myTable.RenderControl(output);
output.Write("Clicked : "+Clicked + " >" +Command);
}
}
}
Please do tell me where I am making a mistake..
"Amar Galla" wrote:
Hi,
I have definitely used complex table objects and controls without
any
problem. Can you paste the full code. Would like to see what exactly is
causing your problem.
Do make sure you add everything to your table, and then add the table
object
to the controls array.
--
Hope this helps.
Regards,
Amar Galla
http://www.dotnetjunkies.com/weblog/amar/
"Kooki" <Kooki@discussions.microsoft.com> wrote in message
news:077913A7-31CE-4893-9F85-1A026B0AA77F@microsoft.com...
Hi!!
I am developing a web part in which I have a table and in the header
of a
table I have placed a button. I am not able to track the button click
event
or Command event. If I place the same button outside of Table cell
then it
works fine but inside the table cell it is not working.
Please help me out.. I shall be very thankful of you for your kind
help.
Thanks
|
|
|
| Back to top |
|
 |
|
|
|
|