473,804 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

GridView Insight ASP 2.0

Hello,

I am new to ASP 2.0 and have been trying to work with the new gridview.
I am running into road blocks as I try to implement quite a simple
functionality. My functionality is as follows

1. There is a grid that manipulates data through two webservices. This
grid has one field that is displayed as a dropdown in Edit mode. The
dropdown box has only two values that can be hardcoded (as opposed to
populating it from the database). The grid has the Edit,Update,Can cel
buttons and only one row can be updated at a time.

There are two buttons SUBMIT and ADDNEW. The SUBMIT buttons posts the
entire grid to the database in one go (internally one could loop
through and make individual calls to the web-service). The ADDNEW
button adds a row to the bottom of the grid to allow a new record to be
edited.

The way I have started to implment it is

a) Create a class with three functions GetData, InsertData, UpdateData.
This class is wired to an object data source

b)Set the autogeneratecol umns = false
c) Made all the fields into bound columns apart from the column STATUS
which is a template Column. The code looks something like this

<Columns>
<asp:BoundFie ld DataField="Func tion_ID"
HeaderText="Fun ction_ID" ReadOnly="True"
Visible="False" />
<asp:BoundFie ld DataField="Desc ription"
HeaderText="Fun ction Name" SortExpression= "Descriptio n" >
<ControlStyle Width="500px" />
<ItemStyle Width="500px" />
</asp:BoundField>
<asp:BoundFie ld DataField="Disp lay_Order"
HeaderText="Dis play Order" ReadOnly="True"
SortExpression= "Display_Or der" />

<asp:TemplateFi eld HeaderText="Sta tus"
SortExpression= "Status">
<EditItemTempla te>
<asp:DropDownLi st ID="ddStatus"
DataValueField= '<%="Status"%> ' runat ="server" Width="100">
<asp:ListItem Value="A">Activ e</asp:ListItem>

<asp:ListItem Value="I">Inact ive</asp:ListItem>

</asp:DropDownLis t>
</EditItemTemplat e>

<Itemtemplate >
<asp:label ID="lblStatus" runat="server"
Text='<%#Bind(" StatusDescripti on")%>' ></asp:label>
</Itemtemplate>

</asp:TemplateFie ld>
<asp:CommandFie ld HeaderText="Edi t"
ShowEditButton= "True" />
</Columns>
Now let's come to the problems :).

1. The first problem is wiring the drop down field. I am not able to
get the database value pre-selected from the dropdown in edit mode.
Also, I am not sure now to implement this. Do I need to write code in
some event?

2. How does the submit work. Can I submit the entire grid at one time?
If yes, then what's the standard procedure to implement such a
functionality.

As one can see.. this is a pretty simple grid. The only complicating
factor is that the data uses multiple web-services which is more or
less dealt which by having a class.

Is my approach correct? Would appreciate some insights.

Regards,
R

Oct 30 '06 #1
1 1464
Hello,

I am new to ASP 2.0 and have been trying to work with the new gridview.

I am running into road blocks as I try to implement quite a simple
functionality. My functionality is as follows
1. There is a grid that manipulates data through two webservices. This
grid has one field that is displayed as a dropdown in Edit mode. The
dropdown box has only two values that can be hardcoded (as opposed to
populating it from the database). The grid has the Edit,Update,Can cel
buttons and only one row can be updated at a time.
There are two buttons SUBMIT and ADDNEW. The SUBMIT buttons posts the
entire grid to the database in one go (internally one could loop
through and make individual calls to the web-service). The ADDNEW
button adds a row to the bottom of the grid to allow a new record to be

edited.
The way I have started to implment it is
a) Create a class with three functions GetData, InsertData, UpdateData.

This class is wired to an object data source
b)Set the autogeneratecol umns = false
c) Made all the fields into bound columns apart from the column STATUS
which is a template Column. The code looks something like this
<Columns>
<asp:BoundFie ld DataField="Func tion_ID"
HeaderText="Fun ction_ID" ReadOnly="True"
Visible="False" />
<asp:BoundFie ld DataField="Desc ription"
HeaderText="Fun ction Name" SortExpression= "Descriptio n" >
<ControlStyle Width="500px" />
<ItemStyle Width="500px" />
</asp:BoundField>
<asp:BoundFie ld DataField="Disp lay_Order"
HeaderText="Dis play Order" ReadOnly="True"
SortExpression= "Display_Or der" />
<asp:TemplateFi eld HeaderText="Sta tus"
SortExpression= "Status">
<EditItemTempla te>
<asp:DropDownLi st ID="ddStatus"
DataValueField= '<%="Status"%> ' runat ="server" Width="100">
<asp:ListItem Value="A">Activ e</asp:ListItem>
<asp:ListItem Value="I">Inact ive</asp:ListItem>

</asp:DropDownLis t>
</EditItemTemplat e>
<Itemtemplate >
<asp:label ID="lblStatus" runat="server"
Text='<%#Bind(" StatusDescripti on")%>' ></asp:label>
</Itemtemplate>
</asp:TemplateFie ld>
<asp:CommandFie ld HeaderText="Edi t"
ShowEditButton= "True" />
</Columns>
Now let's come to the problems :).
1. The first problem is wiring the drop down field. I am not able to
get the database value pre-selected from the dropdown in edit mode.
Also, I am not sure now to implement this. Do I need to write code in
some event?
2. How does the submit work. Can I submit the entire grid at one time?
If yes, then what's the standard procedure to implement such a
functionality.
As one can see.. this is a pretty simple grid. The only complicating
factor is that the data uses multiple web-services which is more or
less dealt which by having a class.
Is my approach correct? Would appreciate some insights.
Regards,
R

Oct 31 '06 #2

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

Similar topics

3
13758
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum. Everyone wants to do a java confirmation box when a user clicks the delete button. Fair enough, basic user design rules state that you should always confirm a delete action. There is also a consensus that the best way to do this is a template...
0
2727
by: jhooper71 | last post by:
Hello any who has some insight to this. In .net 1.1 it was recommended to me by a MS ASP instructor to pass data from a webservice via XML (vs. a Micorosoft data structure (ie. dataset)). The web application consuming the webservice would then read the xml and xmlschema into the dataset. This dataset would be the bound to the "good old" datagrid (sarcasm) at runtime. This would allow the most interroperability/performance with other...
1
1985
by: A_StClaire_ | last post by:
hi all, I am using a GridView bound to an ObjectDataSource. edit and delete functionality has been enabled. my ObjectDataSource is tied to a TableAdapter that accesses three stored procedures - SPGetAllPrograms (Select), SPDeleteProgram (Delete) and SPRetireProgram (Update). deleting database records via clicking the GridView Delete button works fine. as does the Select function. however after clicking the Edit button and making...
10
5313
by: NH | last post by:
I have a girdview with paging enabled. How can I add a message in the footer to say "Viewing records 1-15 of 45" etc Thanks
1
2951
by: davidjgonzalez | last post by:
I have a GridView that has paging enabled. Each item (as defined in an ItemTemplate) includes several controls which have operations i would like to Atlas-enable. Everything is working well except when I page the GridView (the paging controllers are in the gridview's footer). The webpage doesnt scroll back to the top of the page, so when paging through the GridView the user is always looking at the last 4-5 items on the page. My current...
2
27416
by: Tony Hedge | last post by:
This seems more diffciult than it should be, can someone provide any insight? Platform is VB 2005, gridview on a web page. I have this code in the aspx file of a GridView control: <asp:TemplateField > <ItemTemplate> <asp:CheckBox ID="chkNotifierAdd" runat="server"/> </ItemTemplate> </asp:TemplateField>
3
3746
by: Ronald S. Cook | last post by:
I was told that if calling lots of records from the database (let's say 100,000), that the GridView's paging feature would automatically "handle" everything. But the 100,000 records are still coming to the client, right? I mean, the paging feature isn't somehow making calls to the database for 25 records at a time or anything like that is it? I remember in the past having to write nasty stored procedures that took in
4
6087
by: tim.cavins | last post by:
I have a GridView populated by an ObjectDataSource. I am having issues passing the parameters to the objectdatasource. I have verified that the method is being called but none of the parameters are being populated. Integers are being passed as 0 and strings are empty regardless of what I changed them to in Edit mode on the GridView. My object method to perform the update:
2
3509
by: Tim Royal | last post by:
I'm using a GridView inside a Wizard Control with a textbox and two listboxes in the footer. I populate these listboxes from the database if the page isn't on postback (and the textbox is left blank initially). All of these controls have viewstate enabled. When the user fills out the textfield and clicks ADD, I do a check for validation of the data. If the user does not select a valid listbox entry, I abort the rest of the add, and make...
0
9715
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
9595
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
10352
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
10354
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,...
0
10097
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9175
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7642
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
5535
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...
1
4313
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.