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

Interesting Problem in DataGrid

Hi,
I have an interesting problem in DataGrid.I have a footer in the
Datagrid which has a textbox and a link button and im adding values to
the grid.Everything seems to work fine until this point.After adding
the value i bind the data to control.now if refresh my browser the
value that i added recently gets added again.This happens everytime i
refresh the same page.

Im adding the values in the grids Itemcommand by finding out the
commandname of the eventargs.Is this the right way to do.Have anyone
come across this.

Regards
Sabari

Nov 16 '05 #1
3 2806
It may be that each time you postback you are re-adding the new record.
Sometimes you have check whether page is loading for the first time or is it
a postback and take appropriate action. Use Page.IsPostBack property to
find out.

Charlie
"Sabari" <sa*************@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Hi,
I have an interesting problem in DataGrid.I have a footer in the
Datagrid which has a textbox and a link button and im adding values to
the grid.Everything seems to work fine until this point.After adding
the value i bind the data to control.now if refresh my browser the
value that i added recently gets added again.This happens everytime i
refresh the same page.

Im adding the values in the grids Itemcommand by finding out the
commandname of the eventargs.Is this the right way to do.Have anyone
come across this.

Regards
Sabari

Nov 16 '05 #2
When you click on your 'Add' link button, the EVENTTARGET and EVENTARGUMENT
form items are set to process that command on your page.
Whenver you refresh your page, your browser is sending the previous form
values (including the target and argument) to the server and your page will
simply process the command over again.

You should not refresh/reload ASP.NET pages as the postback process means
that unpredictable results can occur.

--
Philip Q
Microsoft MVP [ASP.NET]

"Sabari" <sa*************@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Hi,
I have an interesting problem in DataGrid.I have a footer in the
Datagrid which has a textbox and a link button and im adding values to
the grid.Everything seems to work fine until this point.After adding
the value i bind the data to control.now if refresh my browser the
value that i added recently gets added again.This happens everytime i
refresh the same page.

Im adding the values in the grids Itemcommand by finding out the
commandname of the eventargs.Is this the right way to do.Have anyone
come across this.

Regards
Sabari

Nov 16 '05 #3

Philip Q [MVP] wrote:
When you click on your 'Add' link button, the EVENTTARGET and EVENTARGUMENT form items are set to process that command on your page.
Whenver you refresh your page, your browser is sending the previous form values (including the target and argument) to the server and your page will simply process the command over again.

You should not refresh/reload ASP.NET pages as the postback process means that unpredictable results can occur.

--
Philip Q
Microsoft MVP [ASP.NET]

"Sabari" <sa*************@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Hi,
I have an interesting problem in DataGrid.I have a footer in the
Datagrid which has a textbox and a link button and im adding values to the grid.Everything seems to work fine until this point.After adding the value i bind the data to control.now if refresh my browser the
value that i added recently gets added again.This happens everytime i refresh the same page.

Im adding the values in the grids Itemcommand by finding out the
commandname of the eventargs.Is this the right way to do.Have anyone come across this.

Regards
Sabari

Thanks Philip and Charlie
I found a way to overcome this problem.I enabled
smartnavigation=true in web.config file and it didnt happen after
that.Once again thx for ur reply.
Regards
Sabari

Nov 16 '05 #4

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

Similar topics

8
by: Ashish Shridharan | last post by:
Hi All I have been trying to add a control to the header cell of a datagrid on my ASP.NET page. These controls are defined in the HTML as ASP.NET web controls. They are being added into the...
3
by: Bill C. | last post by:
Hello, I know this has been discussed a lot already because I've been searching around for information the last few weeks. I'm trying to implement a DataGridComboBoxColumn class. I've found...
5
by: BBFrost | last post by:
Win2000 ..Net 1.1 SP1 c# using Visual Studio Ok, I'm currently in a "knock down - drag out" tussle with the .Net 1.1 datagrid. I've come to realize that a 'block' of rows highlighted within...
2
by: pei_world | last post by:
I want to implement a key hit with enter to dropdown a combobox that is in the datagrid. in this case I need to override its original behaviours. I found some codes from the web. Does anyone know...
0
by: mgenti | last post by:
I am experiencing a problem when I add a row to a DataTable that is used on a DataGrid in my Windows Form application. When I add a new row I no longer get a response from my form. I see the row...
2
by: Scott | last post by:
Hi all. A few days ago i ask this question and got a good quick response. I tried out what they said and it worked. However I have now come to try the same thing in another program and it...
1
by: Rick | last post by:
Hello all, I hope all is well with you. I am having a seriously difficult time with this problem. Allow me to set up the problem. I have a System.Web.UI.Page with the following controls...
2
by: CSL | last post by:
I am using the DataGrid in a Windows Application, how can I adjust the widths of each column individually.
7
by: Dave | last post by:
Are there any add-on products or samples available that can do the following in an vb.net datagrid I want to compare 2 rows in a datagrid - one row from one database and another row for another...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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
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.