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

Needing Critical Help.

12 Answers 204 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tooraj
Top achievements
Rank 1
Tooraj asked on 05 Sep 2010, 02:13 PM
Hi all,
I've used a RadGridView in my C# app on a form. At runtime when the user leaves a cell empty Default message provided by the RadGridView appears. First, I want to replace my own message with that message and second how do I must handle such runtime errors:
1. Leaving a newly-added empty row by the user which causes to generate a runtime error.
2. Leaving a cell empty.
3. Accessing the content of a cell for some checkings like Length of the value or something else.
4. When the old value removed by the user I want to showing it again in cases which user don't provide a valid Content.

Thank you very much, Tooraj Azizi.

12 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 07 Sep 2010, 03:39 PM
Hi t,

Thank you for contacting us. Regarding your questions:

Most of the messages that appear in RadGridView are customizable by using localization providers. Please refer the following help article for more details. There are several localization providers in different languages available for download in our code library section. In this case you should localize the NoDataText string.

All other issues can be handled by using our data validation functionality. Please consider the examples in our demo application - "GridView - Manipulate data - Validate Changes" and "GridView - Manipulate data - Indicate Errors".

I hope this helps. If you need further assistance, do not  hesitate to write back.

Best wishes, Jack
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Tooraj
Top achievements
Rank 1
answered on 11 Sep 2010, 12:35 PM
Hi Jack,
Thank you for your answer, here is some of my questions:

1. I wanna to disable showing the message box when occuring an error because of invalid data and showing my own text message.

2. I want to have a custom combobox which has for example 3 items that the user can select them then i want to save its value member to the database.

3. I have a Custom created Calendar which I want to show it in the GridView but I don't know how to do it.

4. where is the guide for using FormatString propery of GridView cell.

5. Is there anyway to have a text cell which has an Ellipsis button?

6. When the user makes a cell Empty, Visual Studio treats with the 'e' parameter as a NULL object, so we can not do anything with it. An example is CellValidating event:

void radGridView1_CellValidating(object sender, CellValidatingEventArgs e)

thank you again Jack, Tooraj Azizi.
0
Jack
Telerik team
answered on 16 Sep 2010, 12:10 PM
Hello t,

Thank you for writing me back. Regarding your questions:

1.
You should handle the DataError event in RadGridView to replace the default error message dialog.

2.
Please consider the following help article, it demonstrates the usage of GridViewComboBoxColumn.

3.
You can use a custom editor in this case. Please refer to the the following help article and "Use Custom Editors" example in our demo application.

4.
The FormatString property uses the same format arguments as string.Format. You can use this MSDN article as a reference.

5.
Yes, this is possible. Please consider the FileName column in the "Use Custom Editors" example in our demo application.

6.
I was not able to reproduce this issue using our latest release - Q2 2010 SP2. Could you you send me a sample application that reproduces it? This will help me to locate the issue and find a proper solution.
Please note that you should open a new support ticket in order to attach your project.

I am looking forward to your reply.

All the best, Jack
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Tooraj
Top achievements
Rank 1
answered on 09 Oct 2010, 10:10 AM
Hi,
Thank you for your answers. Despite of your provided link which refers to Custom Editor in RadGridView, Still I don't know how to embed my FADateTime component in a cell of my GridView. the FADateTime component is a Persian Calendar. Can you send the exact code which I must type to get the result?
Best regards, Tooraj Azizi.
0
Emanuel Varga
Top achievements
Rank 1
answered on 10 Oct 2010, 01:50 PM
Hello Tooraj,

If your FADateTime  is a custom control, which i think it is, you should use RadHostItem in order to host it inside a cells control collection, please check this KB Article, where RadHostItem is being used to host a control (RadButton) inside a cell elements Children collection.

If you need help in creating a custom cell and a custom CellElementProvider please take a look at my posts at this forum thread.

Hope this helps, if you have any other questions or comments, please let me know,

Best Regards,
Emanuel Varga
0
Tooraj
Top achievements
Rank 1
answered on 13 Oct 2010, 08:39 AM
Hi,
Can you put the exact code which I must type in my Application? Only this will solve my problem. FADateTime is a persian calendar and it is like Calendar in VS 2010 toolbox.
I'm waiting for your answer.
Thank you again, Tooraj Azizi.
0
Emanuel Varga
Top achievements
Rank 1
answered on 13 Oct 2010, 09:08 AM
Hello Tooraj,

First of all, without knowing your code it would be very hard for me to tell you exactly what to do, but if it's a big control, i would suggest first mimicking the RadDateTimePicker behavior, create a smaller RadControl inherited control, and add a RadTextBox and a RadButton(ShowCalendar) to it and on ShowCalendar button click show a form with your calendar, just like the normal RadDateTimePicker does.

After that if you can just follow the articles i provided and host that custom control inside the cells collection it will work using RadHostItem.

Hope this helps, if you have any other questions or comments, please let me know,

Best Regards,
Emanuel Varga
0
Tooraj
Top achievements
Rank 1
answered on 15 Oct 2010, 03:51 PM
Hi Emanuel,
Thank you for your attention,
1. First of all, I must say that the DataGridViewFADateTimePickerColumn is a class which I can add it
to VS 2010 DataGridView Component without any problem because this class is derived from DataGridViewColumn class, the class
which lets me add a column to the Grid. after adding the column I have my FADatePicker Calendar in the Grid.
public class DataGridViewFADateTimePickerColumn : DataGridViewColumn
But in order to add a coulmn to RadGridView object, my column must be of type GridViewDataColumn or a type which is derived from this class, While DataGridViewFADateTimePickerColumn is derived from DataGridViewColumn, not from GridViewDataColumn.
I have only the dll not the source code of FADatePicker Component.
I think I must write a class which derives from GridViewDataColumn to let me able to add my FADatePicker Calendar.
class FADatePickerColumn:GridViewDataColumn
{
   override NameOfTheMethodWhichCreatesTheEditorOfColumn;
        {
            execute all code except line of code which determines the type of editor;
            determine the editor type as FADatePicker or DataGridViewFADateTimePickerColumn; 
        }
}
in this class I must override the method which creates the RadTextBox object as default editor of newly added column, If I am right how do I must done this job.

2.
i have two RadGridView objects on my form. RadGridView1 must show records from "One" side of relation and the second RadGridView object, RadGridView2 must show only the related records on the "Many" side of the relation when the user navigate
the RadGridView1 records. 
how do i must do this job?

3.

I have a ExCheckedListBox at the bottom of my RadGridView1 on my form. ExCheckedListBox is a component derived from CheckedListBox component of VS ToolBox which supports having DataSource and DisplayMember property.

I have 3 tables:  Table1,Table2 and Table3.  Table1 (PK1), Table2(FK1,FK2), Table3(PK2).
foreign key equivant for PK1(primary key) field is FK1 and for PK2 is FK2. Table2 connects Table1 and Table3.
the ExCheckedListBox Displays its items(DisplayMember property) from Table3. when the user navigate the RadGridView which shows records of Table1 user can check items of ExCheckedListBox. id of that item with id of the Table1 record are stored in Table2.
so each time the user navigate the Table1 records only the items which their id are stored in Table2 are checked.
I know that I must use the SelectedItem, SelectedIndex, SelectedValue or Value properties of ExCheckedListBox component but after testing many states still I have not get the right answer.
ExCheckedListBox  is like CheckedListBox except that the ExCheckedListBox  supports having DataSource and DisplayMember property.
Please guide me.



Thank you very very much, Tooraj Azizi.
0
Emanuel Varga
Top achievements
Rank 1
answered on 15 Oct 2010, 03:57 PM
Hello again, isn't that this class here?

If it is, then you have all the code there, you just have to adapt it to work with telerik controls.

Please let me know, and after that i will try to help you.

Best Regards,
Emanuel Varga
0
Tooraj
Top achievements
Rank 1
answered on 17 Oct 2010, 12:31 PM
Hello,
I'm working on the class but what about the questions 2 and 3?
thank you.
0
Emanuel Varga
Top achievements
Rank 1
answered on 17 Oct 2010, 12:46 PM
Hello Tooraj,

For question 2, you can register for the CurrentRowChanging (new Index) or CurrentRowChanged event and based on the value of the new current row you can change the value of the second grid,

3. If i understood correctly, you have to change the values in the ExCheckedListBox, based on the current row from table 1, if yes, then you can use the event I've suggested before to set the data source, and set the selected values.

Hope this helps, if you have any other questions or comments, please let me know,

Best Regards,
Emanuel Varga
0
Tooraj
Top achievements
Rank 1
answered on 18 Oct 2010, 05:43 AM
Hello emanuel,
thank you, about FADatePickerCoulmn I must say that I was not successful in adapting the code.
I tried to chage the FADatePickerCoulmn : DataGridViewCoulmn class but I got many errors.
this is the code I must write to get the answer:
class RadFADatePickerColumn: GirdViewDataColumn
{
  
}
I can undestand the code there is some places in code which makes me confused, completing the project is highly depends on completing this code.
Please just write for me the exact code which successfully adds the FADatePicker to my RadGridView object.
Thank you for your great attention, Tooraj.
Tags
GridView
Asked by
Tooraj
Top achievements
Rank 1
Answers by
Jack
Telerik team
Tooraj
Top achievements
Rank 1
Emanuel Varga
Top achievements
Rank 1
Share this question
or