Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
JQgrid Asp.net problem
28/10/2009
06:11
Avatar
suraj.deshpande
New Member
Members
Forum Posts: 1
Member Since:
28/10/2009
sp_UserOfflineSmall Offline

Hello,

I am using  Jqgrid ASP.net version. What I am doing is I want to show checkbox on my jqgrid. I did it with the snipped code given below. But I am getting some strange output.

I am getting "True","false" values on grid instead of actual checkbox (which is either in checked/unchecked state). But when I go for editing the corrosponding row, I am getting checkbox.

My code snippet:

<cc1:JQGrid ID="JQGrid1" runat="server" Width="700px" DataSourceID="Datasource"
        OnCellBinding="JQGrid1_CellBinding" OnRowEditing="JQGrid1_RowEditing" ShowToolBar="true">
        <Columns>
            <cc1:JQGridColumn DataField="ID" PrimaryKey="true" Visible="false" />
            <cc1:JQGridColumn DataField="Name" Editable="true"
                TextAlign="Center" Width="50" />
            <cc1:JQGridColumn DataField="IsActive" EditType="CheckBox" Editable="true" TextAlign="Center" />
        </Columns>
        <ToolBarSettings ShowEditButton="true" ShowAddButton="true" ShowDeleteButton="true" />
    </cc1:JQGrid>

Help is appreciated.

Thanks.

Suraj

31/10/2009
11:58
Avatar
Rumen[Trirand]
Moderator
Members

Moderators
Forum Posts: 81
Member Since:
08/10/2009
sp_UserOfflineSmall Offline

Hello,

EditType = CheckBox (and EditType in general) is only used in edit mode, e.g. in inline or edit dialog editing. In standard read only mode, the value of the actual field is displayed (true / false in your case).

If you wish to modify that, you can hook the CellBinding event, check for that column and modify the default "True / False" formatting to anything you wish HTML-wise, e.g. 

protected void JQGrid1_CellBinding(object sender, Trirand.Web.UI.WebControls.JQGridCellBindEventArgs e)

{

if (e.ColumnIndex == 4)

        {

bool value = Convert.ToBoolean(e.CellHtml);

if (value)

{

e.CellHtml = "<input type='checkbox' disabled='true' checked='true'>";

}

else

{

e.CellHtml = "<input type='checkbox' disabled='true' checked='false'>";

}

}

}

Trirand ASP.NET WebForms & MVC components based on jQuery & ThemeRoller

http://www.trirand.net

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
70 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information