M
Mahesh
I tried to develop a Web Custom Control and it is shown
below.
Imports System.Web.UI.WebControls
Imports System.Web.UI
Imports System.ComponentModel
Namespace Grid
Public Class MyGrid
Inherits System.Web.UI.WebControls.WebControl
Protected Overrides Sub CreateChildCOntrols()
Dim tempTable As New Table()
Dim x As New TableCell()
Dim x1 As New TableCell()
Dim y As New TableRow()
x.Text = "test1"
x1.Text = "test2"
y.Cells.Add(x)
y.Cells.Add(x1)
tempTable.Rows.Add(y)
tempTable.Attributes.Add("border", "1")
Controls.Add(tempTable)
End Sub
Protected Overrides Sub render(ByVal output As
HtmlTextWriter)
EnsureChildControls()
RenderChildren(output)
End Sub
End Class
End Namespace
It generates a table, with 2 cells in one row.
I have few questions about it. I very much appreciate if
anyone can help me find answers to these questions?
1. How do I change the properties of the table in the
design mode?
2. I want to display my own properties. So, how do I
display "customizedtableheaders" under 'property'? How do
I display 2 sub properties (headertext1 & headertext2)
under "customizedtableheader"?
3. When I enter a string value to the "headertext1"
property in the design mode, I want that value to display
in the first cell in the table as a text in the design
mode. The same has to be done with the "headertext2" and
the second cell in the table. How do I do it?
4. How do make the width and the height of the table
change, by dragging it with the mouse?
Please reply me soon if you know the solutions. Thanks a
lot.
below.
Imports System.Web.UI.WebControls
Imports System.Web.UI
Imports System.ComponentModel
Namespace Grid
Public Class MyGrid
Inherits System.Web.UI.WebControls.WebControl
Protected Overrides Sub CreateChildCOntrols()
Dim tempTable As New Table()
Dim x As New TableCell()
Dim x1 As New TableCell()
Dim y As New TableRow()
x.Text = "test1"
x1.Text = "test2"
y.Cells.Add(x)
y.Cells.Add(x1)
tempTable.Rows.Add(y)
tempTable.Attributes.Add("border", "1")
Controls.Add(tempTable)
End Sub
Protected Overrides Sub render(ByVal output As
HtmlTextWriter)
EnsureChildControls()
RenderChildren(output)
End Sub
End Class
End Namespace
It generates a table, with 2 cells in one row.
I have few questions about it. I very much appreciate if
anyone can help me find answers to these questions?
1. How do I change the properties of the table in the
design mode?
2. I want to display my own properties. So, how do I
display "customizedtableheaders" under 'property'? How do
I display 2 sub properties (headertext1 & headertext2)
under "customizedtableheader"?
3. When I enter a string value to the "headertext1"
property in the design mode, I want that value to display
in the first cell in the table as a text in the design
mode. The same has to be done with the "headertext2" and
the second cell in the table. How do I do it?
4. How do make the width and the height of the table
change, by dragging it with the mouse?
Please reply me soon if you know the solutions. Thanks a
lot.