How to edit data before page shown in C1GridView

Posted by: kohcayee on 10 September 2017, 11:50 am EST

  • Posted 10 September 2017, 11:50 am EST

    Here's the question:
    I do not want to bind data to a database because before the page shows I must do something.

    In my case:
    I got this "Score" field in database , four grades: A,B,C,D
    And in the page, there are four columns of Checkbox

    So when I get A from database and I want the first column to be checked, so B stands for the second column being checked.

    I didn't find any useful information either in the Internet or in the Help Document so I come here to see if someone would helps.

    Sorry for my poor English.

    Best Regards,
  • Replied 10 September 2017, 11:50 am EST


    try something like this:


    <asp:Label ID="lblDatum" runat="server" Text='<%# getDateTimeFormat(Eval("Datum")) %>'></asp:Label>


    protected String getDateTimeFormat(object value)
    DateTime dt = (DateTime)value;
    return dt.ToString("ddd, dd.MM.yyyy");
    catch (Exception)
    return "";


    Go in the DataBound Event with foreach throw the rows (c1gridviewros) and change the celltext.

    Please ask for more infos.
  • Replied 10 September 2017, 11:50 am EST

    Thank you for your help, I've handle that.
    But new problem comes:
    I have 4 CheckBoxField and I can't check or uncheck them in page.

    Protected Sub c1gv_RowDataBound(sender As Object, e As C1GridViewRowEventArgs) Handles c1gv.RowDataBound
    Dim cb As CheckBox = e.Row.Cells(5).Controls(0)
    cb.Attributes.Add("onclick", "onClick(" & e.Row.RowIndex & ")")

    e.Row.Attributes.Add("onclick", "onClick(" & e.Row.RowIndex & ")")

    None of the two kinds of code above can effect the CheckBoxField. (the onclick fuction just alert something)
    Again sorry for my poor English

  • Replied 10 September 2017, 11:50 am EST


    You can't check or uncheck the CheckBoxes because they are disabled. They would get enabled only when a row is in Edit mode. For this, you can add a C1CommandField with an Edit button.

    However, if you wish to check/uncheck the Checkboxes without having to add the C1CommandField, you can use the following jQuery code snippet to enable the checkboxes :

    $(document).ready(function () {

    function enableCheckBox() {
    $(".wijdata-type-boolean").find("input").each(function (index, elem) {
    if (elem.type == 'checkbox')
    elem.disabled = false;

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels