Showing posts with label user. Show all posts
Showing posts with label user. Show all posts

Saturday, March 31, 2012

table with a scrollbar?

I have a user control (HTML table) within a table. Would it be possible to
cause the user control to scroll its conents when its container is too
small, or will I just have to make its height = 100% so it can't cause its
container to resize too big?
PaulYou can put your table (or any control) into a fixed size area by putting it
in a scrollable div such as this:
<div id="Layer1" style=" position:relative;width:350px;height:200
px;overflow:
scroll;">control goes here</div>
The key is to use the "overflow" CSS attribute.Here's more info:
http://www.w3schools.com/css/pr_pos_overflow.asp
Another option is to put your control in an IFrame.
http://msdn.microsoft.com/workshop/...ects/IFRAME.asp
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"PJ6" <nobody@.nowhere.net> wrote in message
news:%23EMq6P3oFHA.3760@.TK2MSFTNGP15.phx.gbl...
>I have a user control (HTML table) within a table. Would it be possible to
>cause the user control to scroll its conents when its container is too
>small, or will I just have to make its height = 100% so it can't cause its
>container to resize too big?
> Paul
>
Thanks, that's exactly what I was looking for.
Paul
"Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote in message
news:eI5ghT3oFHA.3912@.TK2MSFTNGP10.phx.gbl...
> You can put your table (or any control) into a fixed size area by putting
> it in a scrollable div such as this:
> <div id="Layer1"
> style=" position:relative;width:350px;height:200
px;overflow:
> scroll;">control goes here</div>
> The key is to use the "overflow" CSS attribute.Here's more info:
> http://www.w3schools.com/css/pr_pos_overflow.asp
> Another option is to put your control in an IFrame.
> http://msdn.microsoft.com/workshop/...://SteveOrr.net
>
> "PJ6" <nobody@.nowhere.net> wrote in message
> news:%23EMq6P3oFHA.3760@.TK2MSFTNGP15.phx.gbl...
>
You may also find this useful. Freeze columns and rows
like Excel but in your html table:
http://www.eggheadcafe.com/articles...rol.asp

Robbe Morris - 2004/2005 Microsoft MVP C#
Earn money answering .NET Framework
messageboard posts at EggHeadCafe.com.
http://www.eggheadcafe.com/forums/merit.asp
"PJ6" <nobody@.nowhere.net> wrote in message
news:%23EMq6P3oFHA.3760@.TK2MSFTNGP15.phx.gbl...
>I have a user control (HTML table) within a table. Would it be possible to
>cause the user control to scroll its conents when its container is too
>small, or will I just have to make its height = 100% so it can't cause its
>container to resize too big?
> Paul
>

table with a scrollbar?

I have a user control (HTML table) within a table. Would it be possible to
cause the user control to scroll its conents when its container is too
small, or will I just have to make its height = 100% so it can't cause its
container to resize too big?

PaulYou can put your table (or any control) into a fixed size area by putting it
in a scrollable div such as this:

<div id="Layer1" style="position:relative;width:350px;height:200px;overflo w:
scroll;">control goes here</div
The key is to use the "overflow" CSS attribute.Here's more info:
http://www.w3schools.com/css/pr_pos_overflow.asp

Another option is to put your control in an IFrame.
http://msdn.microsoft.com/workshop/...ects/IFRAME.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"PJ6" <nobody@.nowhere.net> wrote in message
news:%23EMq6P3oFHA.3760@.TK2MSFTNGP15.phx.gbl...
>I have a user control (HTML table) within a table. Would it be possible to
>cause the user control to scroll its conents when its container is too
>small, or will I just have to make its height = 100% so it can't cause its
>container to resize too big?
> Paul
Thanks, that's exactly what I was looking for.

Paul

"Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote in message
news:eI5ghT3oFHA.3912@.TK2MSFTNGP10.phx.gbl...
> You can put your table (or any control) into a fixed size area by putting
> it in a scrollable div such as this:
> <div id="Layer1"
> style="position:relative;width:350px;height:200px;overflo w:
> scroll;">control goes here</div>
> The key is to use the "overflow" CSS attribute.Here's more info:
> http://www.w3schools.com/css/pr_pos_overflow.asp
> Another option is to put your control in an IFrame.
> http://msdn.microsoft.com/workshop/...ects/IFRAME.asp
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://SteveOrr.net
>
> "PJ6" <nobody@.nowhere.net> wrote in message
> news:%23EMq6P3oFHA.3760@.TK2MSFTNGP15.phx.gbl...
>>I have a user control (HTML table) within a table. Would it be possible to
>>cause the user control to scroll its conents when its container is too
>>small, or will I just have to make its height = 100% so it can't cause its
>>container to resize too big?
>>
>> Paul
>>
You may also find this useful. Freeze columns and rows
like Excel but in your html table:

http://www.eggheadcafe.com/articles...ver_control.asp

--
Robbe Morris - 2004/2005 Microsoft MVP C#

Earn money answering .NET Framework
messageboard posts at EggHeadCafe.com.
http://www.eggheadcafe.com/forums/merit.asp

"PJ6" <nobody@.nowhere.net> wrote in message
news:%23EMq6P3oFHA.3760@.TK2MSFTNGP15.phx.gbl...
>I have a user control (HTML table) within a table. Would it be possible to
>cause the user control to scroll its conents when its container is too
>small, or will I just have to make its height = 100% so it can't cause its
>container to resize too big?
> Paul

Table? Frameset or User control?

Hi!

I am new with ASP and now developing a web application that having two navigation menu.One is at left and another is at top side. When a user click a hyperlink at left, the top navigation menu will change according the hyperlinks at left. And when the user click the hyperlink at top, it will display the required page at bottom right hand side.

I have no idea whether the navigation menu develop as frame, table or user control. Can anyone sharing your opinion? Thanks.Hello, the menu should be a usercontrol, and you should have a look at this page to know how to setp up your pages:

Master Pages

regards

Wednesday, March 28, 2012

TableRows and Postback

I've been at this all day and it's really starting to annoy me now. I have a
form, this has a textbox which the user enters a search parameter into. This
is passed to a Stored Procedure as a parameter, the results returned are the
n
bound to a GridView control. This GridView control has an extra column with
a
checkbox in it for every row. The idea for this being that the user selects
which items he/she would like to use by checking the checkboxes.
Once they have made their selection, they then click a button and this
copies their selections over to an ASP:Table control. The table control is
declaratively created with each table row being dynamically created.
All of the above works fine using the code included in this post. The
problems begin if they then start another search, they want to keep the
values in the table but the table is cleared and populated with the new
values when they add the results of their new search to it.
STEP: User performs a search.
RESULT: GridView populated with results of search
STEP: User selects items they want to use from the GridView and then click
on the Add To List button.
RESULT: Table control has x amount of rows added containing the details as
they appear in the GridView.
STEP: User then selects more items from the same search.
RESULT: The items selected are appended to the table.
STEP: User performs another search and selects the items from those search
results.
RESULT: Table only shows the items that the user has just selected, all the
previous items are lost
I've taken a screenshot of the test form to help you visualize it.
(http://mparter.pwp.blueyonder.co.uk/dyntable.png)
Please save me before I go mad
Thanks.
---CODE--
--
Protected Sub AddToList()
Dim gridRow As GridViewRow
For Each gridRow In GridView1.Rows
Dim gridCell0 As TableCell = gridRow.Cells(0)
Dim gridCell1 As TableCell = gridRow.Cells(1)
Dim gridCell2 As TableCell = gridRow.Cells(2)
Dim gridCell3 As TableCell = gridRow.Cells(3)
Dim gridCell4 As TableCell = gridRow.Cells(4)
Dim chkStudent As HtmlInputCheckBox =
CType(gridCell0.Controls(1), HtmlInputCheckBox)
If Not (chkStudent Is Nothing) And chkStudent.Checked Then
Dim tblRow As New TableRow
Dim tblCell0 As New TableCell
Dim tblCell1 As New TableCell
Dim tblCell2 As New TableCell
Dim tblCell3 As New TableCell
Dim tblCell4 As New TableCell
Dim chkSelectedStudent As New HtmlInputCheckBox
tblCell0.Controls.Add(chkSelectedStudent)
chkSelectedStudent.ID = "chkSelectedStudent_" & gridCell1.Text
chkSelectedStudent.Value = gridCell1.Text
tblRow.Cells.Add(tblCell0)
tblCell1.Controls.Add(New LiteralControl(gridCell1.Text))
tblRow.Cells.Add(tblCell1)
tblCell2.Controls.Add(New LiteralControl(gridCell2.Text))
tblRow.Cells.Add(tblCell2)
tblCell3.Controls.Add(New LiteralControl(gridCell3.Text))
tblRow.Cells.Add(tblCell3)
tblCell4.Controls.Add(New LiteralControl(gridCell4.Text))
tblRow.Cells.Add(tblCell4)
Table1.Rows.Add(tblRow)
End If
Next
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Label1.Text = DateTime.Now.ToString
If Page.IsPostBack Then
AddToList()
End If
End SubI think you need to create a session variable to contain the selected rows
(i.e. Session("AddedItemsTable")=AddedItemsTable, that way previous
selections will be remembered between postbacks.
"Mark Parter" <MarkParter@.discussions.microsoft.com> wrote in message
news:6F3CD5F3-450F-4663-AE2E-91A5F329EFC7@.microsoft.com...
> I've been at this all day and it's really starting to annoy me now. I have
> a
> form, this has a textbox which the user enters a search parameter into.
> This
> is passed to a Stored Procedure as a parameter, the results returned are
> then
> bound to a GridView control. This GridView control has an extra column
> with a
> checkbox in it for every row. The idea for this being that the user
> selects
> which items he/she would like to use by checking the checkboxes.
> Once they have made their selection, they then click a button and this
> copies their selections over to an ASP:Table control. The table control is
> declaratively created with each table row being dynamically created.
> All of the above works fine using the code included in this post. The
> problems begin if they then start another search, they want to keep the
> values in the table but the table is cleared and populated with the new
> values when they add the results of their new search to it.
> STEP: User performs a search.
> RESULT: GridView populated with results of search
> STEP: User selects items they want to use from the GridView and then click
> on the Add To List button.
> RESULT: Table control has x amount of rows added containing the details as
> they appear in the GridView.
> STEP: User then selects more items from the same search.
> RESULT: The items selected are appended to the table.
> STEP: User performs another search and selects the items from those search
> results.
> RESULT: Table only shows the items that the user has just selected, all
> the
> previous items are lost
>
> I've taken a screenshot of the test form to help you visualize it.
> (http://mparter.pwp.blueyonder.co.uk/dyntable.png)
> Please save me before I go mad
> Thanks.
> ---CODE--
--
> Protected Sub AddToList()
> Dim gridRow As GridViewRow
> For Each gridRow In GridView1.Rows
> Dim gridCell0 As TableCell = gridRow.Cells(0)
> Dim gridCell1 As TableCell = gridRow.Cells(1)
> Dim gridCell2 As TableCell = gridRow.Cells(2)
> Dim gridCell3 As TableCell = gridRow.Cells(3)
> Dim gridCell4 As TableCell = gridRow.Cells(4)
> Dim chkStudent As HtmlInputCheckBox =
> CType(gridCell0.Controls(1), HtmlInputCheckBox)
> If Not (chkStudent Is Nothing) And chkStudent.Checked Then
> Dim tblRow As New TableRow
> Dim tblCell0 As New TableCell
> Dim tblCell1 As New TableCell
> Dim tblCell2 As New TableCell
> Dim tblCell3 As New TableCell
> Dim tblCell4 As New TableCell
> Dim chkSelectedStudent As New HtmlInputCheckBox
> tblCell0.Controls.Add(chkSelectedStudent)
> chkSelectedStudent.ID = "chkSelectedStudent_" &
> gridCell1.Text
> chkSelectedStudent.Value = gridCell1.Text
> tblRow.Cells.Add(tblCell0)
> tblCell1.Controls.Add(New LiteralControl(gridCell1.Text))
> tblRow.Cells.Add(tblCell1)
> tblCell2.Controls.Add(New LiteralControl(gridCell2.Text))
> tblRow.Cells.Add(tblCell2)
> tblCell3.Controls.Add(New LiteralControl(gridCell3.Text))
> tblRow.Cells.Add(tblCell3)
> tblCell4.Controls.Add(New LiteralControl(gridCell4.Text))
> tblRow.Cells.Add(tblCell4)
> Table1.Rows.Add(tblRow)
> End If
> Next
> End Sub
> Protected Sub Page_Load(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Me.Load
> Label1.Text = DateTime.Now.ToString
> If Page.IsPostBack Then
> AddToList()
> End If
> End Sub
The changes you are making on the client on not known by the server. Since
<tr> and <td> tags are not postable, their new values never make it back to
the server for processing.
One workaround is to use a <input type="hidden"> element on the page as this
is postable. When you are client side adding rows to your table, you should
alter the value of your hidden field. On postback, you parse the hidden
field and on the server, create the rows and columns you need. You will
need two delimiters, one for each column, and one for a new row:
"col1.1^col1.2^col1.3~col1.2^col2.2^col2.3"
<asp:Table id="tblAddons" runat="server" />
Page_Load
{
string tableValue = String.Empty;
if ( Page.IsPostBack )
{
tableValue = Request.Forms["tblAddons_Value"];
RebuildHtmlTable( tableValue );
}
//always register this hidden field with the previous value.
Page.RegisterHiddenField( "tblAddons_Text", tableValue );
}
//in this method you will create the TableRow and TableCell items based on
the string passed to it.
RebuildHtmlTable( string instructions )
HTH,
bill
"Mark Parter" <MarkParter@.discussions.microsoft.com> wrote in message
news:6F3CD5F3-450F-4663-AE2E-91A5F329EFC7@.microsoft.com...
> I've been at this all day and it's really starting to annoy me now. I have
a
> form, this has a textbox which the user enters a search parameter into.
This
> is passed to a Stored Procedure as a parameter, the results returned are
then
> bound to a GridView control. This GridView control has an extra column
with a
> checkbox in it for every row. The idea for this being that the user
selects
> which items he/she would like to use by checking the checkboxes.
> Once they have made their selection, they then click a button and this
> copies their selections over to an ASP:Table control. The table control is
> declaratively created with each table row being dynamically created.
> All of the above works fine using the code included in this post. The
> problems begin if they then start another search, they want to keep the
> values in the table but the table is cleared and populated with the new
> values when they add the results of their new search to it.
> STEP: User performs a search.
> RESULT: GridView populated with results of search
> STEP: User selects items they want to use from the GridView and then click
> on the Add To List button.
> RESULT: Table control has x amount of rows added containing the details as
> they appear in the GridView.
> STEP: User then selects more items from the same search.
> RESULT: The items selected are appended to the table.
> STEP: User performs another search and selects the items from those search
> results.
> RESULT: Table only shows the items that the user has just selected, all
the
> previous items are lost
>
> I've taken a screenshot of the test form to help you visualize it.
> (http://mparter.pwp.blueyonder.co.uk/dyntable.png)
> Please save me before I go mad
> Thanks.
> ---CODE--
--
> Protected Sub AddToList()
> Dim gridRow As GridViewRow
> For Each gridRow In GridView1.Rows
> Dim gridCell0 As TableCell = gridRow.Cells(0)
> Dim gridCell1 As TableCell = gridRow.Cells(1)
> Dim gridCell2 As TableCell = gridRow.Cells(2)
> Dim gridCell3 As TableCell = gridRow.Cells(3)
> Dim gridCell4 As TableCell = gridRow.Cells(4)
> Dim chkStudent As HtmlInputCheckBox =
> CType(gridCell0.Controls(1), HtmlInputCheckBox)
> If Not (chkStudent Is Nothing) And chkStudent.Checked Then
> Dim tblRow As New TableRow
> Dim tblCell0 As New TableCell
> Dim tblCell1 As New TableCell
> Dim tblCell2 As New TableCell
> Dim tblCell3 As New TableCell
> Dim tblCell4 As New TableCell
> Dim chkSelectedStudent As New HtmlInputCheckBox
> tblCell0.Controls.Add(chkSelectedStudent)
> chkSelectedStudent.ID = "chkSelectedStudent_" &
gridCell1.Text
> chkSelectedStudent.Value = gridCell1.Text
> tblRow.Cells.Add(tblCell0)
> tblCell1.Controls.Add(New LiteralControl(gridCell1.Text))
> tblRow.Cells.Add(tblCell1)
> tblCell2.Controls.Add(New LiteralControl(gridCell2.Text))
> tblRow.Cells.Add(tblCell2)
> tblCell3.Controls.Add(New LiteralControl(gridCell3.Text))
> tblRow.Cells.Add(tblCell3)
> tblCell4.Controls.Add(New LiteralControl(gridCell4.Text))
> tblRow.Cells.Add(tblCell4)
> Table1.Rows.Add(tblRow)
> End If
> Next
> End Sub
> Protected Sub Page_Load(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Me.Load
> Label1.Text = DateTime.Now.ToString
> If Page.IsPostBack Then
> AddToList()
> End If
> End Sub

TableRows and Postback

I've been at this all day and it's really starting to annoy me now. I have a
form, this has a textbox which the user enters a search parameter into. This
is passed to a Stored Procedure as a parameter, the results returned are then
bound to a GridView control. This GridView control has an extra column with a
checkbox in it for every row. The idea for this being that the user selects
which items he/she would like to use by checking the checkboxes.

Once they have made their selection, they then click a button and this
copies their selections over to an ASP:Table control. The table control is
declaratively created with each table row being dynamically created.

All of the above works fine using the code included in this post. The
problems begin if they then start another search, they want to keep the
values in the table but the table is cleared and populated with the new
values when they add the results of their new search to it.

STEP: User performs a search.
RESULT: GridView populated with results of search

STEP: User selects items they want to use from the GridView and then click
on the Add To List button.
RESULT: Table control has x amount of rows added containing the details as
they appear in the GridView.

STEP: User then selects more items from the same search.
RESULT: The items selected are appended to the table.

STEP: User performs another search and selects the items from those search
results.
RESULT: Table only shows the items that the user has just selected, all the
previous items are lost

I've taken a screenshot of the test form to help you visualize it.
(http://mparter.pwp.blueyonder.co.uk/dyntable.png)

Please save me before I go mad

Thanks.

-------------CODE---------------

Protected Sub AddToList()
Dim gridRow As GridViewRow

For Each gridRow In GridView1.Rows

Dim gridCell0 As TableCell = gridRow.Cells(0)
Dim gridCell1 As TableCell = gridRow.Cells(1)
Dim gridCell2 As TableCell = gridRow.Cells(2)
Dim gridCell3 As TableCell = gridRow.Cells(3)
Dim gridCell4 As TableCell = gridRow.Cells(4)

Dim chkStudent As HtmlInputCheckBox =
CType(gridCell0.Controls(1), HtmlInputCheckBox)
If Not (chkStudent Is Nothing) And chkStudent.Checked Then
Dim tblRow As New TableRow
Dim tblCell0 As New TableCell
Dim tblCell1 As New TableCell
Dim tblCell2 As New TableCell
Dim tblCell3 As New TableCell
Dim tblCell4 As New TableCell

Dim chkSelectedStudent As New HtmlInputCheckBox

tblCell0.Controls.Add(chkSelectedStudent)
chkSelectedStudent.ID = "chkSelectedStudent_" & gridCell1.Text
chkSelectedStudent.Value = gridCell1.Text
tblRow.Cells.Add(tblCell0)
tblCell1.Controls.Add(New LiteralControl(gridCell1.Text))
tblRow.Cells.Add(tblCell1)
tblCell2.Controls.Add(New LiteralControl(gridCell2.Text))
tblRow.Cells.Add(tblCell2)
tblCell3.Controls.Add(New LiteralControl(gridCell3.Text))
tblRow.Cells.Add(tblCell3)
tblCell4.Controls.Add(New LiteralControl(gridCell4.Text))
tblRow.Cells.Add(tblCell4)

Table1.Rows.Add(tblRow)
End If
Next
End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Label1.Text = DateTime.Now.ToString
If Page.IsPostBack Then
AddToList()
End If
End SubI think you need to create a session variable to contain the selected rows
(i.e. Session("AddedItemsTable")=AddedItemsTable, that way previous
selections will be remembered between postbacks.

"Mark Parter" <MarkParter@.discussions.microsoft.com> wrote in message
news:6F3CD5F3-450F-4663-AE2E-91A5F329EFC7@.microsoft.com...
> I've been at this all day and it's really starting to annoy me now. I have
> a
> form, this has a textbox which the user enters a search parameter into.
> This
> is passed to a Stored Procedure as a parameter, the results returned are
> then
> bound to a GridView control. This GridView control has an extra column
> with a
> checkbox in it for every row. The idea for this being that the user
> selects
> which items he/she would like to use by checking the checkboxes.
> Once they have made their selection, they then click a button and this
> copies their selections over to an ASP:Table control. The table control is
> declaratively created with each table row being dynamically created.
> All of the above works fine using the code included in this post. The
> problems begin if they then start another search, they want to keep the
> values in the table but the table is cleared and populated with the new
> values when they add the results of their new search to it.
> STEP: User performs a search.
> RESULT: GridView populated with results of search
> STEP: User selects items they want to use from the GridView and then click
> on the Add To List button.
> RESULT: Table control has x amount of rows added containing the details as
> they appear in the GridView.
> STEP: User then selects more items from the same search.
> RESULT: The items selected are appended to the table.
> STEP: User performs another search and selects the items from those search
> results.
> RESULT: Table only shows the items that the user has just selected, all
> the
> previous items are lost
>
> I've taken a screenshot of the test form to help you visualize it.
> (http://mparter.pwp.blueyonder.co.uk/dyntable.png)
> Please save me before I go mad
> Thanks.
> -------------CODE---------------
> Protected Sub AddToList()
> Dim gridRow As GridViewRow
> For Each gridRow In GridView1.Rows
> Dim gridCell0 As TableCell = gridRow.Cells(0)
> Dim gridCell1 As TableCell = gridRow.Cells(1)
> Dim gridCell2 As TableCell = gridRow.Cells(2)
> Dim gridCell3 As TableCell = gridRow.Cells(3)
> Dim gridCell4 As TableCell = gridRow.Cells(4)
> Dim chkStudent As HtmlInputCheckBox =
> CType(gridCell0.Controls(1), HtmlInputCheckBox)
> If Not (chkStudent Is Nothing) And chkStudent.Checked Then
> Dim tblRow As New TableRow
> Dim tblCell0 As New TableCell
> Dim tblCell1 As New TableCell
> Dim tblCell2 As New TableCell
> Dim tblCell3 As New TableCell
> Dim tblCell4 As New TableCell
> Dim chkSelectedStudent As New HtmlInputCheckBox
> tblCell0.Controls.Add(chkSelectedStudent)
> chkSelectedStudent.ID = "chkSelectedStudent_" &
> gridCell1.Text
> chkSelectedStudent.Value = gridCell1.Text
> tblRow.Cells.Add(tblCell0)
> tblCell1.Controls.Add(New LiteralControl(gridCell1.Text))
> tblRow.Cells.Add(tblCell1)
> tblCell2.Controls.Add(New LiteralControl(gridCell2.Text))
> tblRow.Cells.Add(tblCell2)
> tblCell3.Controls.Add(New LiteralControl(gridCell3.Text))
> tblRow.Cells.Add(tblCell3)
> tblCell4.Controls.Add(New LiteralControl(gridCell4.Text))
> tblRow.Cells.Add(tblCell4)
> Table1.Rows.Add(tblRow)
> End If
> Next
> End Sub
> Protected Sub Page_Load(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Me.Load
> Label1.Text = DateTime.Now.ToString
> If Page.IsPostBack Then
> AddToList()
> End If
> End Sub
The changes you are making on the client on not known by the server. Since
<tr> and <td> tags are not postable, their new values never make it back to
the server for processing.

One workaround is to use a <input type="hidden"> element on the page as this
is postable. When you are client side adding rows to your table, you should
alter the value of your hidden field. On postback, you parse the hidden
field and on the server, create the rows and columns you need. You will
need two delimiters, one for each column, and one for a new row:

"col1.1^col1.2^col1.3~col1.2^col2.2^col2.3"

<asp:Table id="tblAddons" runat="server" /
Page_Load
{
string tableValue = String.Empty;
if ( Page.IsPostBack )
{
tableValue = Request.Forms["tblAddons_Value"];
RebuildHtmlTable( tableValue );
}

//always register this hidden field with the previous value.
Page.RegisterHiddenField( "tblAddons_Text", tableValue );
}

//in this method you will create the TableRow and TableCell items based on
the string passed to it.
RebuildHtmlTable( string instructions )

HTH,

bill
"Mark Parter" <MarkParter@.discussions.microsoft.com> wrote in message
news:6F3CD5F3-450F-4663-AE2E-91A5F329EFC7@.microsoft.com...
> I've been at this all day and it's really starting to annoy me now. I have
a
> form, this has a textbox which the user enters a search parameter into.
This
> is passed to a Stored Procedure as a parameter, the results returned are
then
> bound to a GridView control. This GridView control has an extra column
with a
> checkbox in it for every row. The idea for this being that the user
selects
> which items he/she would like to use by checking the checkboxes.
> Once they have made their selection, they then click a button and this
> copies their selections over to an ASP:Table control. The table control is
> declaratively created with each table row being dynamically created.
> All of the above works fine using the code included in this post. The
> problems begin if they then start another search, they want to keep the
> values in the table but the table is cleared and populated with the new
> values when they add the results of their new search to it.
> STEP: User performs a search.
> RESULT: GridView populated with results of search
> STEP: User selects items they want to use from the GridView and then click
> on the Add To List button.
> RESULT: Table control has x amount of rows added containing the details as
> they appear in the GridView.
> STEP: User then selects more items from the same search.
> RESULT: The items selected are appended to the table.
> STEP: User performs another search and selects the items from those search
> results.
> RESULT: Table only shows the items that the user has just selected, all
the
> previous items are lost
>
> I've taken a screenshot of the test form to help you visualize it.
> (http://mparter.pwp.blueyonder.co.uk/dyntable.png)
> Please save me before I go mad
> Thanks.
> -------------CODE---------
-------
> Protected Sub AddToList()
> Dim gridRow As GridViewRow
> For Each gridRow In GridView1.Rows
> Dim gridCell0 As TableCell = gridRow.Cells(0)
> Dim gridCell1 As TableCell = gridRow.Cells(1)
> Dim gridCell2 As TableCell = gridRow.Cells(2)
> Dim gridCell3 As TableCell = gridRow.Cells(3)
> Dim gridCell4 As TableCell = gridRow.Cells(4)
> Dim chkStudent As HtmlInputCheckBox =
> CType(gridCell0.Controls(1), HtmlInputCheckBox)
> If Not (chkStudent Is Nothing) And chkStudent.Checked Then
> Dim tblRow As New TableRow
> Dim tblCell0 As New TableCell
> Dim tblCell1 As New TableCell
> Dim tblCell2 As New TableCell
> Dim tblCell3 As New TableCell
> Dim tblCell4 As New TableCell
> Dim chkSelectedStudent As New HtmlInputCheckBox
> tblCell0.Controls.Add(chkSelectedStudent)
> chkSelectedStudent.ID = "chkSelectedStudent_" &
gridCell1.Text
> chkSelectedStudent.Value = gridCell1.Text
> tblRow.Cells.Add(tblCell0)
> tblCell1.Controls.Add(New LiteralControl(gridCell1.Text))
> tblRow.Cells.Add(tblCell1)
> tblCell2.Controls.Add(New LiteralControl(gridCell2.Text))
> tblRow.Cells.Add(tblCell2)
> tblCell3.Controls.Add(New LiteralControl(gridCell3.Text))
> tblRow.Cells.Add(tblCell3)
> tblCell4.Controls.Add(New LiteralControl(gridCell4.Text))
> tblRow.Cells.Add(tblCell4)
> Table1.Rows.Add(tblRow)
> End If
> Next
> End Sub
> Protected Sub Page_Load(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Me.Load
> Label1.Text = DateTime.Now.ToString
> If Page.IsPostBack Then
> AddToList()
> End If
> End Sub

Saturday, March 24, 2012

TabStrip in User Web Control

I am using a TabStrip control in a .ascx file so I can
create a menu navigation system for my ASP.NET
application. The menu never changes, so I have every page
in the app using the .ascx control. I have the TabStrip
set up, and it calls the pages correctly. However, I
can't figure out how to change the SelectedIndex when the
page loads.

For instance, the application loads with Tab0 as the
default. When I click on Tab1, Response.Redirect takes me
to the appropriate page, but Tab0 is still selected. I
need to be able to programatically change the
SelectedIndex as the page loads, based on what tab was
selected on the previous page. How can I do that? Thanks.

FlynnCheck out this article,
http://msdn.microsoft.com/msdnmag/i...ge/default.aspx

--
Saravana
Microsoft MVP - ASP.NET
www.extremeexperts.com

"Flynn Arrowstarr" <flynnarrowstarr@.nowhere.net> wrote in message
news:000601c3b43f$a9c27a60$a401280a@.phx.gbl...
> I am using a TabStrip control in a .ascx file so I can
> create a menu navigation system for my ASP.NET
> application. The menu never changes, so I have every page
> in the app using the .ascx control. I have the TabStrip
> set up, and it calls the pages correctly. However, I
> can't figure out how to change the SelectedIndex when the
> page loads.
> For instance, the application loads with Tab0 as the
> default. When I click on Tab1, Response.Redirect takes me
> to the appropriate page, but Tab0 is still selected. I
> need to be able to programatically change the
> SelectedIndex as the page loads, based on what tab was
> selected on the previous page. How can I do that? Thanks.
> Flynn

Tabstrip shows only text

I've downloaded IE Web Controls for ASP.NET
I'm using Visual Studio.NET and I included the tabstrip
inside a custom user control.
In the visual studio editor the tab strip appears correctly
but when running on IE it shows only the text labels.!!!!!!!!
I've placed the dll in the bin directory and the webctrl_client
in the same path with the custom control.Well I must add that it works correctly in Mozilla Firefox!!!!
In IE nothing!
I just thought the control was developed from Microsoft OR NOT ? :)
"Stelios Skiathitis" <sski@.keta-notioaigaio.gr> wrote in message
news:d4l852$s47$1@.usenet.otenet.gr...
> I've downloaded IE Web Controls for ASP.NET
> I'm using Visual Studio.NET and I included the tabstrip
> inside a custom user control.
> In the visual studio editor the tab strip appears correctly
> but when running on IE it shows only the text labels.!!!!!!!!
> I've placed the dll in the bin directory and the webctrl_client
> in the same path with the custom control.
>
>
Stelios:
Any chance you have javascript disabled in IE? Perhaps you are using
IE on server 2003 in a hardened security configuration?
Scott
http://www.OdeToCode.com/blogs/scott/
On Tue, 26 Apr 2005 14:22:44 +0300, "Stelios Skiathitis"
<sski@.keta-notioaigaio.gr> wrote:

>I've downloaded IE Web Controls for ASP.NET
>I'm using Visual Studio.NET and I included the tabstrip
>inside a custom user control.
>In the visual studio editor the tab strip appears correctly
>but when running on IE it shows only the text labels.!!!!!!!!
>I've placed the dll in the bin directory and the webctrl_client
>in the same path with the custom control.
>

Tabstrip shows only text

I've downloaded IE Web Controls for ASP.NET

I'm using Visual Studio.NET and I included the tabstrip
inside a custom user control.
In the visual studio editor the tab strip appears correctly
but when running on IE it shows only the text labels.!!!!!!!!

I've placed the dll in the bin directory and the webctrl_client
in the same path with the custom control.Well I must add that it works correctly in Mozilla Firefox!!!!
In IE nothing!
I just thought the control was developed from Microsoft OR NOT ? :)

"Stelios Skiathitis" <sski@.keta-notioaigaio.gr> wrote in message
news:d4l852$s47$1@.usenet.otenet.gr...
> I've downloaded IE Web Controls for ASP.NET
> I'm using Visual Studio.NET and I included the tabstrip
> inside a custom user control.
> In the visual studio editor the tab strip appears correctly
> but when running on IE it shows only the text labels.!!!!!!!!
> I've placed the dll in the bin directory and the webctrl_client
> in the same path with the custom control.
Stelios:

Any chance you have javascript disabled in IE? Perhaps you are using
IE on server 2003 in a hardened security configuration?

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Tue, 26 Apr 2005 14:22:44 +0300, "Stelios Skiathitis"
<sski@.keta-notioaigaio.gr> wrote:

>I've downloaded IE Web Controls for ASP.NET
>I'm using Visual Studio.NET and I included the tabstrip
>inside a custom user control.
>In the visual studio editor the tab strip appears correctly
>but when running on IE it shows only the text labels.!!!!!!!!
>I've placed the dll in the bin directory and the webctrl_client
>in the same path with the custom control.

Thursday, March 22, 2012

Taking a value from one window to another

I want to be able to allow a user to select a word from a list of words, but instead of using a drop down list, I want the user to click a button - which opens a new window containing the list of words, double click on the word (or words) selected, and the value of the word that was double clicked is automatically transferred to a text box in the previous (calling) window. Is this possible in ASP.NET?Passing data back to a parent window is entirely possible via lowly javascript - with or without ASP.NET server technology, but the user interaction method you have decided upon would be a little more unstable across browsers.
window.opener.document.getElementById('textbox1').value = "something";

Tuesday, March 13, 2012

Target Window question

Im trying to target="top" when the user click on the login button - But its not working for me, any ideas where i put Target="top" sorry im new to .aspx

cheers

ZOIK

Example of code.

<asp:Login ID="Login1" runat="server" BackColor="#F7F6F3" BorderColor="#E6E2D8" BorderPadding="4"
BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="Small"
ForeColor="#333333" Height="147px" Width="293px" DestinationPageUrl="~/secure_industry/Default.aspx">
<TitleTextStyle BackColor="#5D7B9D" Font-Bold="True" Font-Size="0.9em" ForeColor="White" />
<InstructionTextStyle Font-Italic="True" Font-Size="Small" ForeColor="Black" />
<TextBoxStyle Font-Size="X-Small" />
<LoginButtonStyle BackColor="#FFFBFF" BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px"
Font-Names="Verdana" Font-Size="Small" ForeColor="#284775"/>
<LabelStyle Font-Size="Small" />
<CheckBoxStyle Font-Size="Small" />
<HyperLinkStyle Font-Size="Small" />
</asp:Login>

Hi,

I think it is not possible to do that with the inbuilt login control. What you can do is create a login template with the code from the below link and then set the onclick event of the button control to target="_top"

http://quickstarts.asp.net/QuickStartv20/util/srcview.aspx?path=~/aspnet/samples/ctrlref/login/LoginTemplate.src

Let me know if you have any issues.


Thanks mate thats excellent.

td tag generating faulty code

I have created a user control using asp:table control. The control generates
a single column menu controls with 5 rows. each row is supposed to have a
image in link tag. The problem is that ASP.Net framework generates closing
"td" tags on new line. This causes to show extra white pixels at the bottom
of each image. This is because of a known bug in "IE" where it has issues
with closing "td" tag on new line.
Question .... is there a way to control the HTML tags generated by ASP.Net
controls so that I can get the UI the way I want it?
Thanks
Naveen K Kohli
http://www.netomatix.comYou would have to override the Render method of the server control, or
possible create a custom control where you specify the HTML to rendered.
David Lloyd
MCSD .NET
http://LemingtonConsulting.com
This response is supplied "as is" without any representations or warranties.
"Naveen K Kohli" <naveenkohli@.hotmail.com> wrote in message
news:#xNFQq#VFHA.1384@.TK2MSFTNGP09.phx.gbl...
I have created a user control using asp:table control. The control generates
a single column menu controls with 5 rows. each row is supposed to have a
image in link tag. The problem is that ASP.Net framework generates closing
"td" tags on new line. This causes to show extra white pixels at the bottom
of each image. This is because of a known bug in "IE" where it has issues
with closing "td" tag on new line.
Question .... is there a way to control the HTML tags generated by ASP.Net
controls so that I can get the UI the way I want it?
Thanks
Naveen K Kohli
http://www.netomatix.com