How do you restrict access to rows or columns in a DataGrid

How do you restrict access to rows or columns in a DataGrid. How do you set the entire DataGrid to ReadOnly. I may be blind but I don't see a ReadOnly property for the datagrid although I find many references to it in google searches etc.

11/6/2006 7:13:50 PM 72751 articles. 3 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 27

Hi auto

The datagrid is read-only by default - you would then have to add code in to make it editable. - have a loko at this site for some tutorials.


Gregor Suttie
11/6/2006 9:14:32 PM
Thanks Gregor, thats actually a pretty cool site! and a great resource!
11/7/2006 8:48:09 PM

Similar Artilces:

How to access a template column in a datagrid control
I have a DataGrid control on a web form with a template column. How can I access the dropdownlist column "ddlusertype" from my c# code? I need to bind it with a DataTable. Please help, thanks! Here is my code <Columns> <asp:BoundColumn DataField="rolName" HeaderText="User Type"></asp:BoundColumn> <asp:BoundColumn DataField="rolDescription" HeaderText="Description"></asp:BoundColumn> <asp:BoundColumn DataField="gtyAbbr" HeaderText="Client Type"></asp:B...

Accessing data in datagrid by row and column.
How can I access a strSection = ddlSection.SelectedValue() For Each d In dgDeadline.Items Dim chk As CheckBox = d.FindControl("chkEnable") Dim key As Guid = dgDeadline.DataKeys(d.ItemIndex) If chk.Checked = True Then Dim sql As String Dim strnewDeadline As DateTime strnewDeadline = "2 / 2 / 2004" sql = "UPDATE TABLE1 SET EXPIRED = GETDATE() WHERE EMP_KEY = @KEY AND ITEM = 'Extend Deadline' AND EXPIRED IS ...

Access dynamically added controls in datagrid column
Hi everyone,does anyone have any idea how to access the value in control in dynamically added column in datagrid?I have this 1 datagrid (datadatagrid) containing a list of data with checkboxes on each record.Once the checkbox is checked, it will be added dynamically to another datagrid (resultdatagrid) with a column in this datagrid containing a dropdownlist control.However when i want to access this resultdatagrid, it did not detect the controls.Does anyone have any idea why? and how to access this control in the dynamically added columns in the datagrid?Thanks..~lydia~...

Dynamic Row, Column & TextBox Control In Datagrid....
Hi,I have to create a  datagrid for my aspx page. The datagrid columns and rows are determined at run time. Even the column name is not a constant ones. I got the solution for column and rows. But now I want to add a text box control for each column and each row of the grid. How can I do it dynamically?Thanks & Regards,KK hello you can use template column anytime Yeah, thats what I'm trying out... But I'm not getting some good pointers on how to do it. The other problem for me is I want to add a column to a datagrid which is not bound to any columns...It will ...

how can i access a control in the edit template column of Datagrid
Hi I want to access or setfocus in a textbox control in the edit template column of a datagrid. i'm using the visual studio 2003 version. thanks for your responses..   Hi, You can browse through the following link. It might help you. ThanksSharmila Use FindControl to get the reference of the textbox in the ItemDataBound event. TextBox tb  = (TextBox )e.Item.FindControl("TextBox1");   I'm sorry.. it doesn't worked.. i need to set focus  to a text box control used in the datagrid's edit template column.. wi...

Access control in footer row of template column from OnInit()
I need to wire an event handler to a CustomValidator control in the footer of a datagrid's template column. I tried doing it in OnInit() but datagrid.FindControl("--controlId--") didn't find the control. How? My code: override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); // Wire server method for validation of each new receipt item CustomValidator NewItemCustomValidator = (CustomValidator)(grdReceiptItem.FindControl ...

Access a column by column name in datagrid?
I am trying to access a column by it's name. I want to do this so if the position of the column changes in the future that the code will not need to be changed. Currently this works: dgDetailD.Columns(0).ItemStyle.BackColor = Color.Red but this does not: dgDetailD.Columns("Processed").ItemStyle.BackColor = Color.Red however, I can access a cell in a dataset like this: DS.Tables(0).Rows(0).Item("Claim Detail D") Does anyone know how to access a column by name in a datagrid?...

How to access datagrid template column textbox text in
I just want to access text from datagrid template column textbox,any one who knows solutions or suggestions(through codes), pls share it.Thanks in advance.  to access text from template column textbox... use FindControl() method... for Ex.,Label1.Text = ((TextBox)GridView1.Rows[0].Cell[0].FindControl("txtTextBox")).Text; //assuming that First Column; cells[0] is the TextBox Column... the code will retrieve text from first column textbox of the first row and assign to can refer to this link also.. Control.FindControl Method (String) (System.Web.UI)  Edit...

How to access a CheckBox in the header row of a Template Column in a data-bound DataGrid
All-- Please help. How can one get a handle to a CheckBox that is in the header row of template column in a DataGrid that is data-bound? See below for details on what does NOT work. Any ideas? Please advise. Thank you. --Mark Here is the code in the ASPX file... <asp:datagrid id="MainDataGrid" runat="server"> <headerstyle horizontalalign="Left" verticalalign="Top" backcolor="LightBlue" font-bold="True" font-size="x-small"></headerstyle> <itemstyle horizontalal...

Solution Title: Datagrid Template Column Radio Button (get access to the rb control)
Hi. I have a radio button in a template column of a datagrid. All I need to know is how to get access to this to be able to set the radio button as checked or unchecked (depending on the results of a query). I'm trying this: Dim rbactionneeded As RadioButton = CType(e.Item.FindControl("rbactionneeded"), RadioButton) If ansval = "Y" Then 'result from stored procedure rbactionneeded.Checked = True End if (very simplified). I'm getting an erro...

How to access column/field names in Datagrid when there are NO COLUMNS!
I'm struggling with LINQ and its insistence on returning results from a stored procedure query as an ISingleResult type instead of a well-understood object like Dataset or Datatable.  I want to do a simple pivot of one data set into another for display. Datagrid is one of the few data objects that will databind with the ISingleResult that LINQ returns after executing our sproc.  I simply want to iterate through the columns in the Datagrid and retrieve the column names and the values, but there are no columns, Columns.Count = 0 after binding the LI...

Restricting printer access (Access Control) with iPrint
Hello. We're having a hard time figuring out how to restrict a printer to be used by a single container... We've, added this container to the User Role section in iManager / iPrint / Manage printers... but still any users can install the printer and print to it... We've also made sure the security level was at least set to medium. Any help would be great! Thanks, Patrick I assume this is an iPrint printer..... If so, you will need to make the printer a secure printer, which will prompt the user for creditials(determine users identity), and then be able to ...

Accessing web controls from within a DataGrid control
Hi, Could someone tell me how to access other web controls from within a datagrid control? I have a ListBox control in a DataGrid, but can't figure out how to set the ListBox's datasource from the code behind. Any help would be great appreciated. Thanks. With the DataGrid you have the ItemDataBound event, where you can find any web control that were added to it, for each row listed in the DataGrid. Ex: Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemDataBound If e.Item....

Cannot access the controls of a page found in a datagrid control
Hello All,I am trying to access the RadioButtonList controls of an aspx page using this code: ..........................................................................................................Dim ctl As ControlDim answers As ArrayListFor Each ctl In Page.Controls(1).Controls   If TypeOf ctl Is RadioButtonList Then       If not CType(ctl, RadioButtonList).SelectedItem Is Nothing Then          Try          answers.Add(CType(ctl, RadioButt...

Web resources about - How do you restrict access to rows or columns in a DataGrid -

Facebook App Developers Can Restrict Access To Open Graph Stories
Facebook application developers now have the option of restricting access to their open graph stories by age, country, or content type. continued… ...

Citing Legal Risks, Facebook Restricts Employee Stock Sales
Facebook implemented a new policy against insider stock trading last Friday. The point is to keep employees with stock to sell from getting in ...

CA unable to restrict Watson's IPL role
Cricket Australia is obliged to relinquish Shane Watson to his Indian Premier League franchise for next month's $6 million Champions League in ...

Protests as Spain restricts abortions (00:43)
RAW VISION: pro-choice demonstrators shout slogans during a protest against their government on abortion issues in Madrid, Spain.

The Taylor Swift effect? Spotify reportedly will restrict music for free users
Free users of the streaming software will notice certain tracks disappearing.

China restricts passports for minorities
China has been accused of banning Tibetans and other ethnic minorities from obtaining passports.

New Jersey law restricts some sex offenders from surfing the Web
Convicted sex offenders who used the Internet to help them commit their crimes will be banned from using the Internet under a measure signed ...

Google restricts 'revenge porn' pic access
Google will allow people whose nude pictures have been posted on websites without their permission to have the image links blocked from its search ...

Healthy welfare card restricts spending on alcohol, gambling
A proposed &quot;technologically advanced&quot; cashless welfare card will link to recipients' mobile phones and restrict them from spending ...

Protests as Spain restricts abortions (00:43)
RAW VISION: pro-choice demonstrators shout slogans during a protest against their government on abortion issues in Madrid, Spain.

Resources last updated: 1/15/2016 6:47:12 PM