Hello Angel,
in my webdatagrid on page load how to set particular rows read only and based on dropdown values how to set that read only rows false.
i am trying to do this in cell entering edit mode client side event but it sets all rows read only.
please tell me how to do..
Thanks
Reshma
hey Reshma,
could you show me how you're trying to do that right now ?
the following forum post could be useful for you:
http://es.infragistics.com/community/forums/t/59560.aspx
Angel
hey Angel,
if (sender.get_rows().get_row(rowIdx).get_cellByColumnKey("colservice").get_value() == "2")
{
eventArgs.set_cancel(true)
}
by this way i am setting rows read only but it by this all rows are read only
Hi Reshma,
Maybe all values are "2", for the colservice column? Could you show me some example data in your grid.
Thanks,
if (dtservice.Rows.Count > 0) {
web_col_service.EditorControl.DataSource = dtservice; web_col_service.EditorControl.DataKeyFields = "service_id"; web_col_service.EditorControl.TextField = "service_name"; web_col_service.EditorControl.ValueField = "service_id";
by this i am populating my dropdown and in dropdown service id is not 2 all the time it 1 to 10 and service_name is hotel,airline,visa and all etc.
so based on this dropdown if i selected hotel whose id is 2 then in last 4 columns of grid i can enter values and if i selected from dropdown any other value then columns should be read only, user cant enter anything
below are my grid columns
<Columns> <ig:BoundDataField Key="colsrno" DataFieldName="srno" Width="30px"> <Header Text="SrNo" /> </ig:BoundDataField> <ig:BoundDataField Key="colserviceid" DataFieldName="service_id" CssClass="hidden"> <Header Text="Service ID" CssClass="hidden" /> </ig:BoundDataField> <ig:BoundDataField Key="colservice" DataFieldName="service_name"> <Header Text="Service Type" /> </ig:BoundDataField> <ig:BoundDataField Key="colcountryid" DataFieldName="country_id" CssClass="hidden"> <Header Text="Country" CssClass="hidden" /> </ig:BoundDataField> <ig:BoundDataField Key="colcountry" DataFieldName="country_name"> <Header Text="Country" /> </ig:BoundDataField> <ig:BoundDataField Key="colcityid" DataFieldName="city_id" CssClass="hidden"> <Header Text="City" CssClass="hidden" /> </ig:BoundDataField> <ig:BoundDataField Key="colcity" DataFieldName="city_name"> <Header Text="City" /> </ig:BoundDataField> <ig:BoundDataField Key="colcureencyid" DataFieldName="currency" CssClass="hidden"> <Header Text="Currency" CssClass="hidden" /> </ig:BoundDataField> <ig:BoundDataField Key="colcureency" DataFieldName="curr_code" CssClass="wrap"> <Header Text="Currency" /> </ig:BoundDataField> <ig:BoundDataField Key="colpricingid" DataFieldName="pricing_group_id" CssClass="hidden"> <Header Text="Pricing Type" CssClass="hidden" /> </ig:BoundDataField> <ig:BoundDataField Key="colpricing" DataFieldName="pricing" CssClass="wrap"> <Header Text="Pricing Type" /> </ig:BoundDataField> <ig:BoundDataField Key="colfromdate" DataFieldName="from_date" DataType="System.DateTime" DataFormatString="{0:dd/MM/yyyy}"> <Header Text="From Date" /> </ig:BoundDataField> <ig:BoundDataField Key="coltodate" DataFieldName="to_date" DataType="System.DateTime" DataFormatString="{0:dd/MM/yyyy}"> <Header Text="To Date" /> </ig:BoundDataField> <ig:BoundDataField Key="colcat" DataFieldName="category"> <Header Text="Category" /> </ig:BoundDataField> <ig:BoundDataField Key="colbudcost" DataFieldName="budget_cost"> <Header Text="Budget Cost" /> </ig:BoundDataField> <ig:BoundDataField Key="colsupcost" DataFieldName="superior_cost"> <Header Text="Superior Cost" /> </ig:BoundDataField> <ig:BoundDataField Key="colprmcost" DataFieldName="premium_cost"> <Header Text="Premium Cost" /> </ig:BoundDataField> <ig:BoundDataField Key="colothercost" DataFieldName="other_service_cost"> <Header Text="Other Service Cost" /> </ig:BoundDataField> <ig:BoundDataField Key="colstarrate" DataFieldName="star_rating"> <Header Text="Star Rating" /> </ig:BoundDataField> <ig:BoundDataField Key="colchkintime" DataFieldName="check_in_time" DataType="System.DateTime" DataFormatString="{0:t}"> <Header Text="Check In Time" /> </ig:BoundDataField> <ig:BoundDataField Key="colchkouttime" DataFieldName="check_out_time" DataType="System.DateTime" DataFormatString="{0:t}"><Header Text="Check Out Time" /> </ig:BoundDataField> <ig:BoundDataField Key="colrooms" DataFieldName="rooms"> <Header Text="No of Rooms" /> </ig:BoundDataField> <ig:BoundDataField Key="colfac" DataFieldName="facility"> <Header Text="Facilities" /> </ig:BoundDataField> </Columns>
This code:
will make all cells read only in a row, where colservice is 2.
if you want the opposite (I mean to disallow editing for values 1-10, excluding 2) , I suggest doing something like this:
if (sender.get_rows().get_row(rowIdx).get_cellByColumnKey("colservice").get_value() != "2")
Hope it helps. Thanks,
hi Angel,
I tried ur code but it sets all rows read only by this.
Then i tried something like this on Cell_EnteringEditMode client event
if (sender.get_rows().get_row(rowIdx).get_cellByColumnKey("colservice").get_value() == "2") { sender._editorProviders._items[6]._input.disabled = false; sender._editorProviders._items[7]._input.disabled = false; sender._editorProviders._items[8]._input.disabled = false; sender._editorProviders._items[9]._input.disabled = false; }
Are you saying this solves your scenario ? Thanks
Hi Angel,
Ok.
hi Reshma,
Ok, great. do not hesitate to contact us in case you have any other questions.
this solves my issue in case of new mode.