473,385 Members | 1,356 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,385 software developers and data experts.

another easy one.

I'm learning today.

So I have a bound datagrid with edit items in it. I've read that in order
to retrieve the values for those edit items (textboxes etc) I can only bind
the grid when NOT postBack.

i.e.
private void Page_Load(object sender, System.EventArgs e)

{

if (!IsPostBack)

{

BindData();

}

}

So my grid initially appears when I go to the page. If I hit the "edit"
link on the grid, the page reloads and the grid doesn't show up. Now, this
makes sense to me, but then how can I get the textbox values on the grid
before the grid binds again.

I'm sure this has been posted before, but I can't seem to find a relevant
answer. Any ideas?

(my code to get the text box values):

dgServices.EditItemIndex = E.Item.ItemIndex;
TextBox editService = (TextBox)
dgServices.Items[dgServices.EditItemIndex].Cells[1].FindControl("edit_Servic
e");

Response.Write(editService .Text);

Any help would be greatly appreciated.

- matt -
Nov 17 '05 #1
1 943
ah. Solved it myself (well...with the help of
http://aspnet.4guysfromrolla.com/art...71002-1.2.aspx)

fyi: I made sure that the grid_Edit() binds the data

i.e.
private void Page_Load(object sender, System.EventArgs e)

{

if (!IsPostBack)

{

BindData();

}

}

public void dgServices_Edit(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)

{

dgServices.EditItemIndex = e.Item.ItemIndex;

BindData();

}

public void dgServices_Update(object sender,
System.Web.UI.WebControls.DataGridCommandEventArgs E)

{

dgServices.EditItemIndex = E.Item.ItemIndex;
TextBox firstBCTextBox = (TextBox)
dgServices.Items[dgServices.EditItemIndex].Cells[1].FindControl("edit_Servic
e");

Response.Write(dgServices.Items[dgServices.EditItemIndex].Cells[0].Text ) ;

}

"Matt M" <matt@remove_this_core49.com> wrote in message
news:WQ***********************@news3.calgary.shaw. ca...
I'm learning today.

So I have a bound datagrid with edit items in it. I've read that in order
to retrieve the values for those edit items (textboxes etc) I can only bind the grid when NOT postBack.

i.e.
private void Page_Load(object sender, System.EventArgs e)

{

if (!IsPostBack)

{

BindData();

}

}

So my grid initially appears when I go to the page. If I hit the "edit"
link on the grid, the page reloads and the grid doesn't show up. Now, this makes sense to me, but then how can I get the textbox values on the grid
before the grid binds again.

I'm sure this has been posted before, but I can't seem to find a relevant
answer. Any ideas?

(my code to get the text box values):

dgServices.EditItemIndex = E.Item.ItemIndex;
TextBox editService = (TextBox)
dgServices.Items[dgServices.EditItemIndex].Cells[1].FindControl("edit_Servic e");

Response.Write(editService .Text);

Any help would be greatly appreciated.

- matt -

Nov 17 '05 #2

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

Similar topics

1
by: ij | last post by:
Hi, I'm trying to submit an image object, along with some other text fields to another web server from within an ASP page but am stuck on getting the image to be submitted with the form. In a...
51
by: nospam | last post by:
THIS IS the DOTNETJUNKIES MESSAGE ------------------------- We're Sorry As many of you know we have recently launched SqlJunkies.com. We have overhauled our runtime and will be using it on...
18
by: John Black | last post by:
Hi, I am not familiar with for_each very well, suppoase I have a vector<pair<unsigned int, unsigned int> > vec1 and the contents are {<0x00000000, 0x000000FF>, <0x10000000, 0x2FFFFFFF>} what...
2
by: andy.dreistadt | last post by:
Hi all, I came across another problem that is probably pretty easy but, again, due to my rusty-ness with C, I'm a little stumped. I have a struct that looks like this: /* Instrument Data...
1
by: Alienz | last post by:
I'm sure this is easy so if you have a sec pls help me out thx. Let say I have an inventory table and at the end of the month I want to move the info in 1 field (total end of month 1) into...
31
by: Peter E. Granger | last post by:
I'm fairly new to C++ and VC++, but for the most part it seems to do most of the same things that can be done in Java, with just some syntactic and structural adjustments. However, one thing I...
3
by: Rune Jacobsen | last post by:
Hi all, I am working on my single instance application that now also has a URL type associated with it, according to the Asynchronous Pluggable Protocols information from MSDN. Now, if my...
9
by: Joshua.Buss | last post by:
I am trying to move a record from one linked table to another within access, but I'm a complete beginner to VBA and don't know exactly where to begin. I have an access file that has the two...
6
by: taylor.ettema | last post by:
I wish to create an application that will be spawned within a host web application after the container app has authorized a user. These two apps are seperately developed/maintained, and can only...
20
by: Johan | last post by:
How can I include one XML file into another XML file (on the client side, in Firefox)? I think XInclude is just what I need, but Firefox doesn't support it:...
1
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: 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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.