473,320 Members | 1,951 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

creating a data entry screen without the gridview.

I want to display 'n' records for a table-driven data entry page.
The first column should be readonly and the 2nd column, a checkbox WRITABLE
(NOT READONLY).
I can't use the gridview because it creates -> checked="checked"
disabled="disabled"
What I need is more like this;

<form id="form1" runat="server">
<div>
<table>
<tr>
<td style="width: 100px">
<asp:Label ID="Label1" runat="server" Text="Column
Name"></asp:Label></td>
<td style="width: 100px">
<asp:CheckBox ID="CheckBox1" text="Include column in
report" runat="server" /></td>
</tr>

Since all the nice and easy databinding doesn't work with the gridview, how
do I create the above html on the fly as I loop throught the sql datareader?

Thank you,
-Greg

Apr 30 '06 #1
9 3507
you could use an <asp:Table> instead of an HTML table and add rows to it on
the fly. I don't understand why a GridView won't work though, you can use
template fields to display whatever you want in each column

"hazz" wrote:
I want to display 'n' records for a table-driven data entry page.
The first column should be readonly and the 2nd column, a checkbox WRITABLE
(NOT READONLY).
I can't use the gridview because it creates -> checked="checked"
disabled="disabled"
What I need is more like this;

<form id="form1" runat="server">
<div>
<table>
<tr>
<td style="width: 100px">
<asp:Label ID="Label1" runat="server" Text="Column
Name"></asp:Label></td>
<td style="width: 100px">
<asp:CheckBox ID="CheckBox1" text="Include column in
report" runat="server" /></td>
</tr>

Since all the nice and easy databinding doesn't work with the gridview, how
do I create the above html on the fly as I loop throught the sql datareader?

Thank you,
-Greg

Apr 30 '06 #2
Thank you once again. The thing I am trying to avoid with the template
fields is that I would like all checkboxes editable without having to select
an edit hyperlink with each row. I would like the user to be able to select
several editable checkboxes quickly and then have a save button to commit
all the changes at once.
I think you <asp.Table> idea is a good one. It ontakes me back to earlier
times when I used to do that. I just have to remember how to generate that
from the server side. A bunch of response.writes?
Appreciatively,
-Greg

"clickon" <cl*****@discussions.microsoft.com> wrote in message
news:1E**********************************@microsof t.com...
you could use an <asp:Table> instead of an HTML table and add rows to it
on
the fly. I don't understand why a GridView won't work though, you can use
template fields to display whatever you want in each column

"hazz" wrote:
I want to display 'n' records for a table-driven data entry page.
The first column should be readonly and the 2nd column, a checkbox
WRITABLE
(NOT READONLY).
I can't use the gridview because it creates -> checked="checked"
disabled="disabled"
What I need is more like this;

<form id="form1" runat="server">
<div>
<table>
<tr>
<td style="width: 100px">
<asp:Label ID="Label1" runat="server" Text="Column
Name"></asp:Label></td>
<td style="width: 100px">
<asp:CheckBox ID="CheckBox1" text="Include column in
report" runat="server" /></td>
</tr>

Since all the nice and easy databinding doesn't work with the gridview,
how
do I create the above html on the fly as I loop throught the sql
datareader?

Thank you,
-Greg

Apr 30 '06 #3
You can still do this with the GridView - stick a literal into your
template, and handle the databinding event.

Then set the Text of your literal to <input type="checkbox"
name="someCheckboxGroupName" value="someValue" />

Then in your button's click handler use

Request.Form["someCheckboxGroupName"]

to get the selected value.
hazz wrote:
Thank you once again. The thing I am trying to avoid with the template
fields is that I would like all checkboxes editable without having to select
an edit hyperlink with each row. I would like the user to be able to select
several editable checkboxes quickly and then have a save button to commit
all the changes at once.
I think you <asp.Table> idea is a good one. It ontakes me back to earlier
times when I used to do that. I just have to remember how to generate that
from the server side. A bunch of response.writes?
Appreciatively,
-Greg

"clickon" <cl*****@discussions.microsoft.com> wrote in message
news:1E**********************************@microsof t.com...
you could use an <asp:Table> instead of an HTML table and add rows to it
on
the fly. I don't understand why a GridView won't work though, you can use
template fields to display whatever you want in each column

"hazz" wrote:
I want to display 'n' records for a table-driven data entry page.
The first column should be readonly and the 2nd column, a checkbox
WRITABLE
(NOT READONLY).
I can't use the gridview because it creates -> checked="checked"
disabled="disabled"
What I need is more like this;

<form id="form1" runat="server">
<div>
<table>
<tr>
<td style="width: 100px">
<asp:Label ID="Label1" runat="server" Text="Column
Name"></asp:Label></td>
<td style="width: 100px">
<asp:CheckBox ID="CheckBox1" text="Include column in
report" runat="server" /></td>
</tr>

Since all the nice and easy databinding doesn't work with the gridview,
how
do I create the above html on the fly as I loop throught the sql
datareader?

Thank you,
-Greg


Apr 30 '06 #4
"hazz" <hazz@sonic_net> wrote in message
news:eE**************@TK2MSFTNGP02.phx.gbl...
Thank you once again. The thing I am trying to avoid with the template
fields is that I would like all checkboxes editable without having to
select an edit hyperlink with each row. I would like the user to be able
to select several editable checkboxes quickly and then have a save button
to commit all the changes at once.


Following on from clickon's response, I can't see what your problem is
here...

When your page is posted back by the Save button, the value of all of the
checkboxes will be retained in ViewState - simply iterate through the page's
control collection, filter out anything which isn't a checkbox, and then
take appropriate action depending on whether each individual checkbox is
checked or not.
Apr 30 '06 #5
Thank you for the ideas! I just discovered the literal control. I'm making
some progress finally! Thanks again. -Greg

"Flinky Wisty Pomm" <Pa********@gmail.com> wrote in message
news:11**********************@j73g2000cwa.googlegr oups.com...
You can still do this with the GridView - stick a literal into your
template, and handle the databinding event.

Then set the Text of your literal to <input type="checkbox"
name="someCheckboxGroupName" value="someValue" />

Then in your button's click handler use

Request.Form["someCheckboxGroupName"]

to get the selected value.
hazz wrote:
Thank you once again. The thing I am trying to avoid with the template
fields is that I would like all checkboxes editable without having to
select
an edit hyperlink with each row. I would like the user to be able to
select
several editable checkboxes quickly and then have a save button to commit
all the changes at once.
I think you <asp.Table> idea is a good one. It ontakes me back to earlier
times when I used to do that. I just have to remember how to generate
that
from the server side. A bunch of response.writes?
Appreciatively,
-Greg

"clickon" <cl*****@discussions.microsoft.com> wrote in message
news:1E**********************************@microsof t.com...
> you could use an <asp:Table> instead of an HTML table and add rows to
> it
> on
> the fly. I don't understand why a GridView won't work though, you can
> use
> template fields to display whatever you want in each column
>
> "hazz" wrote:
>
>> I want to display 'n' records for a table-driven data entry page.
>> The first column should be readonly and the 2nd column, a checkbox
>> WRITABLE
>> (NOT READONLY).
>> I can't use the gridview because it creates -> checked="checked"
>> disabled="disabled"
>> What I need is more like this;
>>
>> <form id="form1" runat="server">
>> <div>
>> <table>
>> <tr>
>> <td style="width: 100px">
>> <asp:Label ID="Label1" runat="server" Text="Column
>> Name"></asp:Label></td>
>> <td style="width: 100px">
>> <asp:CheckBox ID="CheckBox1" text="Include column
>> in
>> report" runat="server" /></td>
>> </tr>
>>
>> Since all the nice and easy databinding doesn't work with the
>> gridview,
>> how
>> do I create the above html on the fly as I loop throught the sql
>> datareader?
>>
>> Thank you,
>> -Greg
>>
>>
>>
>>

May 1 '06 #6
clickon has been very helpful. I think the template fields once understood
are probably very versatile and will do everything I want. It's just taking
a few days to explore the problem and learn the controls. thanks. -greg

"Mark Rae" <ma**@markN-O-S-P-A-M.co.uk> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
"hazz" <hazz@sonic_net> wrote in message
news:eE**************@TK2MSFTNGP02.phx.gbl...
Thank you once again. The thing I am trying to avoid with the template
fields is that I would like all checkboxes editable without having to
select an edit hyperlink with each row. I would like the user to be able
to select several editable checkboxes quickly and then have a save button
to commit all the changes at once.


Following on from clickon's response, I can't see what your problem is
here...

When your page is posted back by the Save button, the value of all of the
checkboxes will be retained in ViewState - simply iterate through the
page's control collection, filter out anything which isn't a checkbox, and
then take appropriate action depending on whether each individual checkbox
is checked or not.

May 1 '06 #7
You can also use the repeater control if you don't want all the
functionality that is available with gridview or datagrid.

In a repeater control you can specify the html like you are doing right now,
and repeater is very "light" compared to a grid view or datagrid

--
Swanand Mokashi
Microsoft Certified Solution Developer (.NET) - Early Achiever
Microsoft Certified Application Developer (.NET)

http://www.dotnetgenerics.com/
DotNetGenerics.com -- anything and everything about Microsoft .NET
technology ...

http://www.swanandmokashi.com/
http://www.swanandmokashi.com/HomePage/WebServices/
Home of the Stock Quotes, Quote of the day and Horoscope web services
"hazz" <hazz@sonic_net> wrote in message
news:ug**************@TK2MSFTNGP03.phx.gbl...
clickon has been very helpful. I think the template fields once understood
are probably very versatile and will do everything I want. It's just
taking a few days to explore the problem and learn the controls.
thanks. -greg

"Mark Rae" <ma**@markN-O-S-P-A-M.co.uk> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
"hazz" <hazz@sonic_net> wrote in message
news:eE**************@TK2MSFTNGP02.phx.gbl...
Thank you once again. The thing I am trying to avoid with the template
fields is that I would like all checkboxes editable without having to
select an edit hyperlink with each row. I would like the user to be able
to select several editable checkboxes quickly and then have a save
button to commit all the changes at once.


Following on from clickon's response, I can't see what your problem is
here...

When your page is posted back by the Save button, the value of all of the
checkboxes will be retained in ViewState - simply iterate through the
page's control collection, filter out anything which isn't a checkbox,
and then take appropriate action depending on whether each individual
checkbox is checked or not.


May 1 '06 #8
Thank you very much Swanand. I am actually trying that now. Here are a few
lines of my code; I am currently trying to implement the actual database
values into this repeater code that is creating the checkboxes just the way
I would like to see them. -Greg

Repeater1.HeaderTemplate = new Template(ListItemType.Header);
Repeater1.ItemTemplate = new Template(ListItemType.Item);
Repeater1.AlternatingItemTemplate = new
Template(ListItemType.AlternatingItem);
Repeater1.FooterTemplate = new Template(ListItemType.Footer);

public void InstantiateIn(System.Web.UI.Control container)
{
Literal lc = new Literal();
switch (templateType)
{
case ListItemType.Header:
lc.Text = "<TABLE border=1><TR><TH>Items</TH></TR>";
break;
case ListItemType.Item:
lc.Text = "<TR><TD>Item number: " + itemcount.ToString() +
"</TD>";
break;
case ListItemType.AlternatingItem:
lc.Text = "<TD> <input type= checkbox name=
someCheckboxGroupName value= someValue /> " + "</TD></TR>";
break;
case ListItemType.Footer:
lc.Text = "</TABLE>";
break;
}
container.Controls.Add(lc);

based on http://msdn2.microsoft.com/en-us/lib...ck(VS.80).aspx
"Swanand Mokashi" <sw***********@swanandmokashi.com> wrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
You can also use the repeater control if you don't want all the
functionality that is available with gridview or datagrid.

In a repeater control you can specify the html like you are doing right
now, and repeater is very "light" compared to a grid view or datagrid

--
Swanand Mokashi
Microsoft Certified Solution Developer (.NET) - Early Achiever
Microsoft Certified Application Developer (.NET)

http://www.dotnetgenerics.com/
DotNetGenerics.com -- anything and everything about Microsoft .NET
technology ...

http://www.swanandmokashi.com/
http://www.swanandmokashi.com/HomePage/WebServices/
Home of the Stock Quotes, Quote of the day and Horoscope web services
"hazz" <hazz@sonic_net> wrote in message
news:ug**************@TK2MSFTNGP03.phx.gbl...
clickon has been very helpful. I think the template fields once
understood are probably very versatile and will do everything I want.
It's just taking a few days to explore the problem and learn the
controls. thanks. -greg

"Mark Rae" <ma**@markN-O-S-P-A-M.co.uk> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
"hazz" <hazz@sonic_net> wrote in message
news:eE**************@TK2MSFTNGP02.phx.gbl...

Thank you once again. The thing I am trying to avoid with the template
fields is that I would like all checkboxes editable without having to
select an edit hyperlink with each row. I would like the user to be
able to select several editable checkboxes quickly and then have a save
button to commit all the changes at once.

Following on from clickon's response, I can't see what your problem is
here...

When your page is posted back by the Save button, the value of all of
the checkboxes will be retained in ViewState - simply iterate through
the page's control collection, filter out anything which isn't a
checkbox, and then take appropriate action depending on whether each
individual checkbox is checked or not.



May 1 '06 #9
Sounds good -- glad could be of help :)

--
Swanand Mokashi
Microsoft Certified Solution Developer (.NET) - Early Achiever
Microsoft Certified Application Developer (.NET)

http://www.dotnetgenerics.com/
DotNetGenerics.com -- anything and everything about Microsoft .NET
technology ...

http://www.swanandmokashi.com/
http://www.swanandmokashi.com/HomePage/WebServices/
Home of the Stock Quotes, Quote of the day and Horoscope web services
"hazz" <hazz@sonic_net> wrote in message
news:OU****************@TK2MSFTNGP05.phx.gbl...
Thank you very much Swanand. I am actually trying that now. Here are a few
lines of my code; I am currently trying to implement the actual database
values into this repeater code that is creating the checkboxes just the
way I would like to see them. -Greg

Repeater1.HeaderTemplate = new Template(ListItemType.Header);
Repeater1.ItemTemplate = new Template(ListItemType.Item);
Repeater1.AlternatingItemTemplate = new
Template(ListItemType.AlternatingItem);
Repeater1.FooterTemplate = new Template(ListItemType.Footer);

public void InstantiateIn(System.Web.UI.Control container)
{
Literal lc = new Literal();
switch (templateType)
{
case ListItemType.Header:
lc.Text = "<TABLE border=1><TR><TH>Items</TH></TR>";
break;
case ListItemType.Item:
lc.Text = "<TR><TD>Item number: " + itemcount.ToString() +
"</TD>";
break;
case ListItemType.AlternatingItem:
lc.Text = "<TD> <input type= checkbox name=
someCheckboxGroupName value= someValue /> " + "</TD></TR>";
break;
case ListItemType.Footer:
lc.Text = "</TABLE>";
break;
}
container.Controls.Add(lc);

based on http://msdn2.microsoft.com/en-us/lib...ck(VS.80).aspx
"Swanand Mokashi" <sw***********@swanandmokashi.com> wrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
You can also use the repeater control if you don't want all the
functionality that is available with gridview or datagrid.

In a repeater control you can specify the html like you are doing right
now, and repeater is very "light" compared to a grid view or datagrid

--
Swanand Mokashi
Microsoft Certified Solution Developer (.NET) - Early Achiever
Microsoft Certified Application Developer (.NET)

http://www.dotnetgenerics.com/
DotNetGenerics.com -- anything and everything about Microsoft .NET
technology ...

http://www.swanandmokashi.com/
http://www.swanandmokashi.com/HomePage/WebServices/
Home of the Stock Quotes, Quote of the day and Horoscope web services
"hazz" <hazz@sonic_net> wrote in message
news:ug**************@TK2MSFTNGP03.phx.gbl...
clickon has been very helpful. I think the template fields once
understood are probably very versatile and will do everything I want.
It's just taking a few days to explore the problem and learn the
controls. thanks. -greg

"Mark Rae" <ma**@markN-O-S-P-A-M.co.uk> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
"hazz" <hazz@sonic_net> wrote in message
news:eE**************@TK2MSFTNGP02.phx.gbl...

> Thank you once again. The thing I am trying to avoid with the template
> fields is that I would like all checkboxes editable without having to
> select an edit hyperlink with each row. I would like the user to be
> able to select several editable checkboxes quickly and then have a
> save button to commit all the changes at once.

Following on from clickon's response, I can't see what your problem is
here...

When your page is posted back by the Save button, the value of all of
the checkboxes will be retained in ViewState - simply iterate through
the page's control collection, filter out anything which isn't a
checkbox, and then take appropriate action depending on whether each
individual checkbox is checked or not.



May 1 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: theKirk | last post by:
using Visual Studio 2005 C# ASP.NET I know there has to be a simple way to do this....I want to use C# in a code behind for aspx. Populate a GridView from an xml file Add Fields to the...
2
by: Richard Wakeman | last post by:
Hi - On a data entry screen with misc. input boxes, such as for Name, Telephone Number, etc., when tabing down the input screen, Access will highlight whole contents in that box. Sometimes I'd...
7
by: Susan Bricker | last post by:
Greetings. As a relative newcomer to Access, I am having trouble deciding on how to design the form flow for updating and creating related records. I'm looking for a variety of suggestions so...
5
by: Brian McClellan | last post by:
Just wondering if anyone has a simple example of creating a gridview completely programmatically, i'm not doing anything terribly sophisticated. When creating the gridview declaratively evertying...
2
by: gmccallum | last post by:
I have a data entry screen using controls bound through a bindingSource, TableAdaptor and a BindingNavigator to move through the records. When I have an data entry error (such as Null for a value)...
26
by: nyathancha | last post by:
Hi, How Do I create an instance of a derived class from an instance of a base class, essentially wrapping up an existing base class with some additional functionality. The reason I need this is...
0
by: Adam Sandler | last post by:
Hello, Prior to posting I looked at http://groups.google.com/group/ microsoft.public.dotnet.framework.aspnet/browse_thread/thread/ d8d5ae243614085e/d4fd6c4a5aa56f75 ...
0
by: lianaent | last post by:
Hi All, I'm brand new to asp.net 2.0, and have a simple task of just creating a quick and dirty data entry form with SQL Server 2005 on the back end. I added a gridview to my form, and I can...
3
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I have a generic list of data list <typelistcategory; listcategory = new list <type>; I also have a dropdown box that I have put into a template column of a gridview. I was able to populate...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.