473,403 Members | 2,293 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,403 software developers and data experts.

Fixed the problem

CW
I didn't have
If !Page.IsPostBack
//bind data source

in the code

"CW" <a> wrote in message news:um**************@TK2MSFTNGP12.phx.gbl...
I am taking the Commerce Starter Kit sample from asp.net and trying to add a page that allows user to edit product categories.

I am doing so via the use of a datagrid. html portion related to the data
grid is as per follows:

<asp:datagrid id=dgProductCategories runat="server"
AutoGenerateColumns="False" DataSource="<%# DataSet11 %>" Width="275px"
BorderColor="#999999" BorderStyle="None" BackColor="White" CellPadding="3"
GridLines="Vertical" BorderWidth="1px" DataKeyField="CategoryID"
DataMember="CMRC_Categories">
<SelectedItemStyle Font-Bold="True" ForeColor="White"
BackColor="#008A8C"></SelectedItemStyle>
<AlternatingItemStyle
BackColor="Gainsboro"></AlternatingItemStyle>
<ItemStyle ForeColor="Black" BackColor="#EEEEEE"></ItemStyle> <HeaderStyle Font-Bold="True" ForeColor="White"
BackColor="#000084"></HeaderStyle>
<FooterStyle ForeColor="Black"
BackColor="#CCCCCC"></FooterStyle>
<Columns>
<asp:BoundColumn DataField="CategoryID"
SortExpression="CategoryID" ReadOnly="True"
HeaderText="ID"></asp:BoundColumn>
<asp:BoundColumn DataField="CategoryName"
SortExpression="CategoryName" HeaderText="Category Name"></asp:BoundColumn> <asp:EditCommandColumn ButtonType="LinkButton"
UpdateText="Update" HeaderText="Edit" CancelText="Cancel"
EditText="Edit"></asp:EditCommandColumn>
<asp:ButtonColumn Text="Delete" HeaderText="Delete"
CommandName="Delete"></asp:ButtonColumn>
</Columns>
<PagerStyle HorizontalAlign="Center" ForeColor="Black"
BackColor="#999999" Mode="NumericPages"></PagerStyle>
</asp:datagrid>

The code behind that handles the Update command is as per follows:

Private Sub dgProductCategories_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
dgProductCategories.UpdateCommand
Dim dr As DataSet1.CMRC_CategoriesRow
dr =
Me.DataSet11.CMRC_Categories.FindByCategoryID(CInt (Me.dgProductCategories.It ems(e.Item.ItemIndex).Cells(0).Text))
Dim tbProductCategory As System.Web.UI.WebControls.TextBox =
CType(e.Item.Cells(1).Controls(0), System.Web.UI.WebControls.TextBox)
dr.Item(1) = tbProductCategory.Text
Me.SqlDataAdapter1.Update(Me.DataSet11)
Me.dgProductCategories.EditItemIndex = -1
Me.dgProductCategories.DataBind()
End Sub

e.Item.Cells(1).Controls(0) supposed to the be the textbox when datagrid is in edit mode. However, in debug mode, I could tell that the value in the
text box is the original value, rather than the edited value. Of course this means that the edit operation would have no effect.

I also tried using
Me.dgProductCategories.Items(e.Item.ItemIndex).Cel ls(1).Controls(0) instead of e.Item.Cells(1).Controls(0) in the code. However, it made no difference.
Any idea what's happening there?

Thanks in advance

CW

Nov 18 '05 #1
0 893

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

Similar topics

26
by: Adrian Parker | last post by:
I'm using the code below in my project. When I print all of these fixed length string variables, one per line, they strings in questions do not properly pad with 0s. strQuantity prints as " ...
179
by: SoloCDM | last post by:
How do I keep my entire web page at a fixed width? ********************************************************************* Signed, SoloCDM
6
by: Marie ALHOMME | last post by:
Hi everybody ! I'm new here, and I'm French, so pardon me for any and all grammar and typo mistakes ! I hope you'll understand everything anyway :) I'm working on my portfolio site, which I...
6
by: Mason A. Clark | last post by:
Masters: On two or three-column layouts, one column often has a list of links. Scrolling the page hides them. I'm aware there's supposed to be the ability to fix the column (frame-like). I...
9
by: pout | last post by:
What are the purposes of fixed-point? When should it be used? I read: #define Int2Fixed(x) (((long)(short)x) << 16) and the fixed-point in 16.16 format. Does the 16 in the MACRO refer to...
3
by: Xavier Wargny | last post by:
Hi all and each! Since july, I'm working with dot NET technology. Confident with brand new tools it gave, I decided to use that new decimal type (related with the Database type...). After many...
4
by: Otie | last post by:
Hello, I am using the MSFlexGrd Control in VB5. I have 1 fixed row and one fixed column. I am trying to do a sort when the user clicks a column in the FIXED ROW. But when I capture the row...
1
by: Rick Knospler | last post by:
I am trying to convert a vb6 project to vb.net. The conversion worked for the most part except for the fixed length strings and fixed length string arrays. Bascially the vb6 programmer stored all...
1
by: tehweb | last post by:
Background: I have a fixed position div on the bottom om my page. I have then added a dialog-div into this fixed position one. When I bring up the dialog, everything works if the the scrollTop is...
9
by: Mr Prister | last post by:
I've tried to create a sidebar that uses the fixed positioning property. However after looking through various tutorials and how to's of the web I can't find a bugger wrong with my code. This is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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,...
0
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...
0
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,...

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.