This is a migrated thread and some comments may be shown as answers.

how to disable data grid editing and deleting

18 Answers 193 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Bee
Top achievements
Rank 1
Bee asked on 19 Nov 2012, 09:54 AM
i have a data grid that populates data from sql on page load and its working fine. however  users are able to edit, delete these items although it doesnt affect the database. how do i set the data grid to avoid this

18 Answers, 1 is accepted

Sort by
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 19 Nov 2012, 10:17 AM
Hello,

Just set the ReadOnly flag to true on the grid itself.

If you have any other questions, please let me know.


Best Regards,
Emanuel Varga
WinForms MVP
0
Bee
Top achievements
Rank 1
answered on 19 Nov 2012, 10:27 AM
waal it worked like magic, many thanks, will come back with more questions though
0
Emanuel Varga
Top achievements
Rank 1
answered on 19 Nov 2012, 10:28 AM
Hello,

Glad to be able to help, if this solved your problem, please mark all appropriate answers so that other users will be able to find their answer quicker,

Thank you,

If you have any other questions, please let me know.

Best Regards,
Emanuel Varga
Winforms MVP
0
Bee
Top achievements
Rank 1
answered on 19 Nov 2012, 10:31 AM
many thank for your time, on that same grid how do i add horizontal and vertical scroll bars
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 19 Nov 2012, 10:39 AM
Hello again,

You can change the default behavior of the scroll bars, using
grid.VerticalScrollState = ScrollState.AlwaysShow;
grid.HorizontalScrollState = ScrollState.AlwaysShow;

The vertical scroll bar will not be visible if AutoSizeColumnsMode is set to Fill.

If you have any other questions, please let me know.

Best Regards,
Emanuel Varga
Winforms MVP
0
Bee
Top achievements
Rank 1
answered on 19 Nov 2012, 10:50 AM
yep you are right, that solves it... well am still a newbie to telerik rad controls thats why am bombarding with all the questions and so far so good,
0
Bee
Top achievements
Rank 1
answered on 19 Nov 2012, 10:54 AM
now i want to avoid a situation whereby a user can open a form while another one is open on the project.ie stipulating to one open form at a time, how will i achieve that?
0
Emanuel Varga
Top achievements
Rank 1
answered on 19 Nov 2012, 10:55 AM
Hell again,

Glad to be able to help, but please don't unmark previous correct answers, because there are different questions there are multiple answers, otherwise if you prefer, please open a new thread.

If you have any other questions, please let me know.

Best Regards,
Emanuel Varga
WinForms MVP
0
Emanuel Varga
Top achievements
Rank 1
answered on 19 Nov 2012, 11:02 AM
Don't really understand what you want here, please try to add more details to this

Best Regards,
Emanuel Varga
WinForms MVP
0
Bee
Top achievements
Rank 1
answered on 19 Nov 2012, 11:18 AM
i have an mdi form and within that mdi form there are multiple forms, so i dont want a situation whereby a user can open as many forms as possible. all i want is the user to open only one form at a time so that the project will not allow you to open any other form without closing an already open form
0
Emanuel Varga
Top achievements
Rank 1
answered on 19 Nov 2012, 11:23 AM
Hello again,

If you have access to the MdiParent form, you can just check the number of MdiChildren.Lenght and based on this create the other form or not.

If you have any other questions, please let me know.


Best Regards,
Emanuel Varga
WinForms MVP
0
Bee
Top achievements
Rank 1
answered on 19 Nov 2012, 12:24 PM
i am struggling to go around it, this is the code i have to open the child forms from the parent
dim child as new frmcustomers
child.mdiparent=me
child.show()
i+=1

so how do i restrict from this
0
Emanuel Varga
Top achievements
Rank 1
answered on 19 Nov 2012, 12:30 PM
if (me.MdiChildren.Lenght > 0)
// do not create any more forms because there is at least 1 child created
   return;

dim child as new frmcustomers
child.mdiparent=me
child.show()

Best Regards,
Emanuel Varga
WinForms MVP
0
Bee
Top achievements
Rank 1
answered on 19 Nov 2012, 12:38 PM
have used
if me.mdichildren.length>0 then
return
dim child as new frmcustomers
child.mdiparent=me
child.show()
i+=1

its saying unused local variable child and when i run the project and try to open the frmcustomers, it doesnt open
0
Emanuel Varga
Top achievements
Rank 1
answered on 19 Nov 2012, 01:13 PM
Do you have any mdichildren in the beginning? wasn't this the ideea? to have only one child active?

Best Regards,
Emanuel Varga
WinForms MVP
0
Bee
Top achievements
Rank 1
answered on 19 Nov 2012, 01:28 PM
i have used this code and its working
dim child as new frmcustomers
frmcustomers.showdialog()
i+=1

but then it doesnt clear the dropdown with the list of forms i chose the frmcustomers from until i click somewhere
0
Emanuel Varga
Top achievements
Rank 1
answered on 19 Nov 2012, 01:44 PM
What dropdown? Can you please create a very small sample and post it?

Best Regards,
Emanuel Varga
WinForms MVP
0
Bee
Top achievements
Rank 1
answered on 19 Nov 2012, 02:08 PM
its not a drop down sorry,its names of child forms on my mdi. so from there i am clicking frm customers,  so i am saying that this list with form options to chose these child names(frmcustomers and frmrates) is still visible after i chose my preferred form and only disappers when i click anywhere on the screen

Private Sub RadMenuButtonItem3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadMenuButtonItem3.Click
        Dim child As New frmcustomers
        frmcustomers.ShowDialog()
 i += 1
end sub
Private Sub RadMenuButtonItem4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadMenuButtonItem4.Click
        Dim child As New frmRates
        frmRates.ShowDialog()
        i += 1
    End Sub
Tags
GridView
Asked by
Bee
Top achievements
Rank 1
Answers by
Emanuel Varga
Top achievements
Rank 1
Bee
Top achievements
Rank 1
Share this question
or