473,839 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="checke d"
disabled="disab led"
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 3533
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="checke d"
disabled="disab led"
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*****@discus sions.microsoft .com> wrote in message
news:1E******** *************** ***********@mic rosoft.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="checke d"
disabled="disab led"
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="someCheck boxGroupName" value="someValu e" />

Then in your button's click handler use

Request.Form["someCheckboxGr oupName"]

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*****@discus sions.microsoft .com> wrote in message
news:1E******** *************** ***********@mic rosoft.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="checke d"
disabled="disab led"
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******** ******@TK2MSFTN GP02.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********@gma il.com> wrote in message
news:11******** **************@ j73g2000cwa.goo glegroups.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="someCheck boxGroupName" value="someValu e" />

Then in your button's click handler use

Request.Form["someCheckboxGr oupName"]

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*****@discus sions.microsoft .com> wrote in message
news:1E******** *************** ***********@mic rosoft.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="checke d"
>> disabled="disab led"
>> 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******** ********@TK2MSF TNGP04.phx.gbl. ..
"hazz" <hazz@sonic_net > wrote in message
news:eE******** ******@TK2MSFTN GP02.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******** ******@TK2MSFTN GP03.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******** ********@TK2MSF TNGP04.phx.gbl. ..
"hazz" <hazz@sonic_net > wrote in message
news:eE******** ******@TK2MSFTN GP02.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.Heade rTemplate = new Template(ListIt emType.Header);
Repeater1.ItemT emplate = new Template(ListIt emType.Item);
Repeater1.Alter natingItemTempl ate = new
Template(ListIt emType.Alternat ingItem);
Repeater1.Foote rTemplate = new Template(ListIt emType.Footer);

public void InstantiateIn(S ystem.Web.UI.Co ntrol container)
{
Literal lc = new Literal();
switch (templateType)
{
case ListItemType.He ader:
lc.Text = "<TABLE border=1><TR><T H>Items</TH></TR>";
break;
case ListItemType.It em:
lc.Text = "<TR><TD>It em number: " + itemcount.ToStr ing() +
"</TD>";
break;
case ListItemType.Al ternatingItem:
lc.Text = "<TD> <input type= checkbox name=
someCheckboxGro upName value= someValue /> " + "</TD></TR>";
break;
case ListItemType.Fo oter:
lc.Text = "</TABLE>";
break;
}
container.Contr ols.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******** ********@TK2MSF TNGP02.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******** ******@TK2MSFTN GP03.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******** ********@TK2MSF TNGP04.phx.gbl. ..
"hazz" <hazz@sonic_net > wrote in message
news:eE******** ******@TK2MSFTN GP02.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******** ********@TK2MSF TNGP05.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.Heade rTemplate = new Template(ListIt emType.Header);
Repeater1.ItemT emplate = new Template(ListIt emType.Item);
Repeater1.Alter natingItemTempl ate = new
Template(ListIt emType.Alternat ingItem);
Repeater1.Foote rTemplate = new Template(ListIt emType.Footer);

public void InstantiateIn(S ystem.Web.UI.Co ntrol container)
{
Literal lc = new Literal();
switch (templateType)
{
case ListItemType.He ader:
lc.Text = "<TABLE border=1><TR><T H>Items</TH></TR>";
break;
case ListItemType.It em:
lc.Text = "<TR><TD>It em number: " + itemcount.ToStr ing() +
"</TD>";
break;
case ListItemType.Al ternatingItem:
lc.Text = "<TD> <input type= checkbox name=
someCheckboxGro upName value= someValue /> " + "</TD></TR>";
break;
case ListItemType.Fo oter:
lc.Text = "</TABLE>";
break;
}
container.Contr ols.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******** ********@TK2MSF TNGP02.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******** ******@TK2MSFTN GP03.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******** ********@TK2MSF TNGP04.phx.gbl. ..
"hazz" <hazz@sonic_net > wrote in message
news:eE******** ******@TK2MSFTN GP02.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
5679
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 GridView to allow entry of quantity and Y/N switch for
2
2184
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 like to be able to jump to the end or the beginning of that input box to start typing without overwritting what's already in there. In other words, if I key a Home or an End key, the cursor will jump to the tabs at top or out of the screen. If I...
7
1857
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 that I can decide what's best for the user and what's best for screen flow. Here's the structure: I have what's called "an Event". Each Event can have multiple "Trials". Each "Trial" can multiple "Classes". (This is the structure for a dog...
5
15349
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 works fine, however programmatically, while the grid will display data that exsists in the database, any operation on the data ( editing/updating/deleting ) seems to cause a rowdeleting/updating etc error. Or is this simply not meant to be done?
2
4529
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) I get the following error raised all the way to the App.Run command. This is not a dataGridView, so I can not use that DataError event to catch it. I have tried the BindingSource_DataError event, but that does not seem to get fired. There is...
26
5383
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 because I am not always able to control/create all the different constructors the base class has. My problem can be described in code as follows ... /* This is the base class with a whole heap of constructors/functionality*/ public class Animal
0
4331
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 http://groups.google.com/group/microsoft.public.dotnet.framework.aspnet/browse_thread/thread/abb4bcc39312a388/2de51eba9a0bcfd6 Hello,
0
1572
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 populate it dynamically by choosing from a dropdown that I populate dynamically from the database sys.tables table. When I choose a table from my dropdown, poof, the gridview is beautifully loaded with all the columns and rows, and the edit and delete...
3
1721
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 the dropdown box ok when it was outside of the gridview for (int i = 0; i <= listcategory.Count - 1; i++) { ddl.Items.Add(listcategory.Description);
0
9856
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9698
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10914
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10597
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10656
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7834
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7022
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5684
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
3136
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.