473,587 Members | 2,316 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Editing in gridview

6 New Member
Hi experts

I have googled for tips/solutuins and failed to get a right method to implement following scenario.

I have a gridview populated with data on page load from my sourcetable.
Tomake it precise say I have fields Ac_Id, Ac_Name, Balance, and user_Id in my table accounts. The user_Id and Ac_Id forms the composite key.

I have 3 rows in my table as follows

1, Cash, 1000, ABC
2. CITI, 8000, ABC
3. BOA , 6000, ABC

While editing in grid I want let user edit only the balance field if Ac_Name is Cash otherwise User can Edit both Ac_Name and Balance.

Kris
Mar 22 '10 #1
3 2205
CroCrew
564 Recognized Expert Contributor
Hello krisviswa,

Please post your code so we know what we are working with to help you out.

Thanks,
CroCrew~
Mar 24 '10 #2
krisviswa
6 New Member
Dear Mr.cro

thanks for volunteering help. I could solve the issue in row_upadating event by checking the values from edit item template text boxes and changing the textbox bind property to read only if the value is cash.
Expand|Select|Wrap|Line Numbers
  1. Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GridView1.RowUpdating
  2.         name = CType(GridView1.Rows(e.RowIndex).FindControl("Textbox1"), TextBox) )
  3.         If name.Text = "Cash"  then
  4.         name.Text="'<%#Eval("Ac_Name") %>'"
  5.  
regards and look forward for same cooperation in future issues

thanks once again
kris
Mar 25 '10 #3
CroCrew
564 Recognized Expert Contributor
Anytime.

Happy coding,
CroCrew~
Mar 25 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1080
by: Fred K. Augustine, Jr | last post by:
After upgrading from Visual Web Developer Beta2 to the final release version, web forms that contained GridView controls set up for data editing stopped working properly. No error is produced but the editing changes are not committed to the database (I am currently using SQL Server 2000). I have also created completely new web forms with the...
5
19037
by: misiek | last post by:
Hi all. I would like to know if it is possible to dynamically enable/disable row editing in GridView control in ASP.NET 2.0. I am asking because this feature should be enabled/disable depending on button, which was clicked by user. Thanks in advance, misiek
1
6169
by: K B | last post by:
I just installed VS 2005...both GridView and DetailsView, I'm using a SQLdataSource and both controls do NOT have a checkbox for Enable Editing. Help please!!! Thanks, Kit
1
1867
by: AmitKu | last post by:
I've got the Gridview going at full speed, and I've enabled editing, but when I click on the "edit" button, this ugly editing UI comes up. Well it's not ugly, but it's not great either. How do I change the font/font size of the text thats being edited? Thanks in advance, Amit
0
1450
by: HP | last post by:
Hi there I have a datalist control with some bound controls in its Item Template and a gridview bound to one of those fields (residing also in Item Template). I've found out that when I click Edit on the gridview (same happens when editing other gridview which is outside the datalist) all datalist bound fields (except the gridview)...
3
13393
by: cpnet | last post by:
I have a GridView which I'm populating from an ObjectDataSource (give the GridView a DataTable). The GridView will have about 20 rows, and only one editable column. The editable column consists of a RadioButtonList ("Yes", "No", "Not Answered") in a TemplateColumn. I want the user to be able to select a radio button for each row in the...
5
4670
by: =?Utf-8?B?QWRhciBXZXNsZXk=?= | last post by:
Hi All, I have a GridView inside the EditItemTemplate of a FormView. Both FormView and GridView are data bound using an ObjectDataSource. When the FormView's ObjectDataSource object has a SelectParameters with a SessionParameter in the parameters collection and the object stored in the Session is a reference type, the DataGrid fails to...
2
1671
by: vinodkus | last post by:
<asp: editCommandColumnis not available in version 2.0 then how an editing is possible in gridview.
5
5130
by: =?Utf-8?B?Z3V5?= | last post by:
How do you enable editing in a GridView programatically rather than via its Tasks menu? Guy
4
3060
by: ASPnewb1 | last post by:
Hello, I have a 2-dimensional array created from the following text file: data1=asdfawe data2=2 data3=223d data4=22
0
7915
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7843
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8220
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5712
isladogs
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3840
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3872
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2347
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.