473,320 Members | 1,916 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.

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,Cancel
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 autogeneratecolumns = 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:BoundField DataField="Function_ID"
HeaderText="Function_ID" ReadOnly="True"
Visible="False" />
<asp:BoundField DataField="Description"
HeaderText="Function Name" SortExpression="Description" >
<ControlStyle Width="500px" />
<ItemStyle Width="500px" />
</asp:BoundField>
<asp:BoundField DataField="Display_Order"
HeaderText="Display Order" ReadOnly="True"
SortExpression="Display_Order" />

<asp:TemplateField HeaderText="Status"
SortExpression="Status">
<EditItemTemplate>
<asp:DropDownList ID="ddStatus"
DataValueField='<%="Status"%>' runat ="server" Width="100">
<asp:ListItem Value="A">Active</asp:ListItem>

<asp:ListItem Value="I">Inactive</asp:ListItem>

</asp:DropDownList>
</EditItemTemplate>

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

</asp:TemplateField>
<asp:CommandField HeaderText="Edit"
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 1436
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,Cancel
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 autogeneratecolumns = 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:BoundField DataField="Function_ID"
HeaderText="Function_ID" ReadOnly="True"
Visible="False" />
<asp:BoundField DataField="Description"
HeaderText="Function Name" SortExpression="Description" >
<ControlStyle Width="500px" />
<ItemStyle Width="500px" />
</asp:BoundField>
<asp:BoundField DataField="Display_Order"
HeaderText="Display Order" ReadOnly="True"
SortExpression="Display_Order" />
<asp:TemplateField HeaderText="Status"
SortExpression="Status">
<EditItemTemplate>
<asp:DropDownList ID="ddStatus"
DataValueField='<%="Status"%>' runat ="server" Width="100">
<asp:ListItem Value="A">Active</asp:ListItem>
<asp:ListItem Value="I">Inactive</asp:ListItem>

</asp:DropDownList>
</EditItemTemplate>
<Itemtemplate>
<asp:label ID="lblStatus" runat="server"
Text='<%#Bind("StatusDescription")%>' ></asp:label>
</Itemtemplate>
</asp:TemplateField>
<asp:CommandField HeaderText="Edit"
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
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....
0
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...
1
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...
10
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
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...
2
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: ...
3
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...
4
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...
2
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...
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
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...
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: 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: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.