Hi,
I have an ASP.NET application using C# code. I am using a datagrid to
display records from a database based on a user input, i.e a user enters a
compnay name in text box & when he clicks a "Submit" button, only those
records are displayed where company name matches with user input.
I need the datagrid to be editable. For this i used the walkthrough from
..NET "Using a datagrid for reading & writing data to database" or it was some
similar name.
This code works fine when the datagrid shows all records but for the data
grid which shows only the records based on user input, this walkthrough
doesnt work. I think its bcoz i fill the dataset on "Submit" button click
rather than on page load. So when I hit the submit button after entering
Company name, I get to view records of that company. But WHEN I HIT the EDIT
LINK NEXT TO THE RECORD , I DONT SEE EDIT, UPDATE & CANCEL BUTTONS. I can
ONLY see those buttons when I hit submit again!!!
How to get over this?
--
pmud 3 2259
Yes, your idea is likely. Move the code that fills the dataset to its own
routine and call from the button click. Call again from the EDIT postback
routine just prior to asking for a particular edit column. If not, you will
get either a) nothing or b) whatever is "cached" in viewstate.
---
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
"pmud" wrote: Hi,
I have an ASP.NET application using C# code. I am using a datagrid to display records from a database based on a user input, i.e a user enters a compnay name in text box & when he clicks a "Submit" button, only those records are displayed where company name matches with user input.
I need the datagrid to be editable. For this i used the walkthrough from .NET "Using a datagrid for reading & writing data to database" or it was some similar name. This code works fine when the datagrid shows all records but for the data grid which shows only the records based on user input, this walkthrough doesnt work. I think its bcoz i fill the dataset on "Submit" button click rather than on page load. So when I hit the submit button after entering Company name, I get to view records of that company. But WHEN I HIT the EDIT LINK NEXT TO THE RECORD , I DONT SEE EDIT, UPDATE & CANCEL BUTTONS. I can ONLY see those buttons when I hit submit again!!!
How to get over this?
-- pmud
i agree. however, if you need to update the datagrid on page_load, you need
to do the following otherwise you will be running in circles.
void Page_Load(){
if(!Page.IsPostBack){
//put your function here
}
}
hope this helps.
bg
"Cowboy (Gregory A. Beamer) - MVP" wrote: Yes, your idea is likely. Move the code that fills the dataset to its own routine and call from the button click. Call again from the EDIT postback routine just prior to asking for a particular edit column. If not, you will get either a) nothing or b) whatever is "cached" in viewstate.
---
Gregory A. Beamer MVP; MCP: +I, SE, SD, DBA
*************************** Think Outside the Box! ***************************
"pmud" wrote:
Hi,
I have an ASP.NET application using C# code. I am using a datagrid to display records from a database based on a user input, i.e a user enters a compnay name in text box & when he clicks a "Submit" button, only those records are displayed where company name matches with user input.
I need the datagrid to be editable. For this i used the walkthrough from .NET "Using a datagrid for reading & writing data to database" or it was some similar name. This code works fine when the datagrid shows all records but for the data grid which shows only the records based on user input, this walkthrough doesnt work. I think its bcoz i fill the dataset on "Submit" button click rather than on page load. So when I hit the submit button after entering Company name, I get to view records of that company. But WHEN I HIT the EDIT LINK NEXT TO THE RECORD , I DONT SEE EDIT, UPDATE & CANCEL BUTTONS. I can ONLY see those buttons when I hit submit again!!!
How to get over this?
-- pmud
Hi Gregory,
For updating the SQL database using data grid , is primary key required? I
dont have a primary key in the SQl table. Is it possible to do the same
thing if I dont want to make a primary key ???
"Cowboy (Gregory A. Beamer) - MVP" wrote: Yes, your idea is likely. Move the code that fills the dataset to its own routine and call from the button click. Call again from the EDIT postback routine just prior to asking for a particular edit column. If not, you will get either a) nothing or b) whatever is "cached" in viewstate.
---
Gregory A. Beamer MVP; MCP: +I, SE, SD, DBA
*************************** Think Outside the Box! ***************************
"pmud" wrote:
Hi,
I have an ASP.NET application using C# code. I am using a datagrid to display records from a database based on a user input, i.e a user enters a compnay name in text box & when he clicks a "Submit" button, only those records are displayed where company name matches with user input.
I need the datagrid to be editable. For this i used the walkthrough from .NET "Using a datagrid for reading & writing data to database" or it was some similar name. This code works fine when the datagrid shows all records but for the data grid which shows only the records based on user input, this walkthrough doesnt work. I think its bcoz i fill the dataset on "Submit" button click rather than on page load. So when I hit the submit button after entering Company name, I get to view records of that company. But WHEN I HIT the EDIT LINK NEXT TO THE RECORD , I DONT SEE EDIT, UPDATE & CANCEL BUTTONS. I can ONLY see those buttons when I hit submit again!!!
How to get over this?
-- pmud This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Alex |
last post by:
Interested in more .NET stuff visit www.dedicatedsolutions.co.uk
The DataList is not as powerful as the DataGrid. It requires more work
from you since it has no default data presentation format....
|
by: DC |
last post by:
Newbie's question about .NET datagrid
If I use:
<asp:EditCommandColumn></asp:EditCommandColumn>
When I edit a row, it will automatically show Update and Cancel Link.
But when I use:...
|
by: Chris Brandsma |
last post by:
I'm thinking this is simple, but...
I added an Edit/Update/Cancel column to a DataGrid. Any time I hit the
edit/Update/Cancel button the grid returns blank (no rows returned but the
header and...
|
by: Steve Kallal |
last post by:
I have a DataGrid with an EditCommandColumn column set to a type of PushButton. I want to set set CssClass on these buttons and cannot without using code-behind code on the ItemDataBound event. The...
|
by: rkbnair |
last post by:
Is there any way to display an image button instead of the traditional
Edit/Update/Cancel push button in a datagrid (with bound data)?
|
by: rp13 |
last post by:
Hi,
I am using a asp:datagrid which is editable. Though I have handlers wired to my edit, update & cancel events, some how when i click on the edit button nothing happens. The edit template...
|
by: bh |
last post by:
I'm trying to edit data in a datagrid through a dropdown list with different
id/text values. The problem comes in when I click the edit button & nothing
appears to be happening. Did I do...
|
by: rn5a |
last post by:
A Form has a DataGrid which displays records from a SQL Server 2005 DB
table. Users can modify the records using this DataGrid for which I am
using EditCommandColumn in the DataGrid. This is the...
|
by: slinky |
last post by:
I had a successfully deployed datagrid reading an XML file and
showing the data:
Private Function MakeDataView() as DataView
Dim myDataSet As New DataSet()...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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,...
|
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...
|
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...
|
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: 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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |