5 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 24 Apr 2008, 07:56 AM
Hi Mohamed,
Try the following code snippet to achieve the desired scenario.
ASPX:
CS:
Hope this helps..
Princy.
Try the following code snippet to achieve the desired scenario.
ASPX:
| <rad:GridBoundColumn UniqueName="Bit" HeaderText="Bit" DataField="Bit" ></rad:GridBoundColumn> |
CS:
| protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
| { |
| if (e.Item is GridDataItem) |
| { |
| GridDataItem item = (GridDataItem)e.Item; |
| string strtxt = item["Bit"].Text.ToString(); |
| if (strtxt == "True") |
| { |
| item["Bit"].Text="Yes"; |
| } |
| else |
| item["Bit"].Text = "No"; |
| } |
| } |
Hope this helps..
Princy.
0
Mohammad Bourisly
Top achievements
Rank 1
answered on 24 Apr 2008, 08:17 AM
Hi Princy
thanks
this is work in desplay mode but in editing mode i want to desplay it as redio button or things like that
thanks
this is work in desplay mode but in editing mode i want to desplay it as redio button or things like that
0
Shinu
Top achievements
Rank 2
answered on 24 Apr 2008, 09:37 AM
Hello,
You can bind the bit field to a GridCheckBox column.
ASPX:
You can also go through the following demo link to get details about the Column types supported by RadGrid.
Column types
Shinu.
You can bind the bit field to a GridCheckBox column.
ASPX:
| <rad:GridCheckBoxColumn HeaderText="BitField" DataField="BitField" UniqueName="BitField"> |
| </rad:GridCheckBoxColumn> |
You can also go through the following demo link to get details about the Column types supported by RadGrid.
Column types
Shinu.
0
Mohammad Bourisly
Top achievements
Rank 1
answered on 24 Apr 2008, 10:26 AM
Hello Shinu
i have this senario
i have filed in table called Status integer type it has only values (0,1 or 2)
in UI
i want to map
0 to YES
1 to No
2 to NOT SURE
gridview
in display mode show text of (YES,NO or NOTSURE) depends on binding
in editing mode
show dropdwonlist to select from this values (YES,NO or NOTSURE) and bind it to database
i have this senario
i have filed in table called Status integer type it has only values (0,1 or 2)
in UI
i want to map
0 to YES
1 to No
2 to NOT SURE
gridview
in display mode show text of (YES,NO or NOTSURE) depends on binding
in editing mode
show dropdwonlist to select from this values (YES,NO or NOTSURE) and bind it to database
0
Princy
Top achievements
Rank 2
answered on 25 Apr 2008, 06:54 AM
Hi,
Try the following code snippet to achieve the desired scenario.
ASPX:
CS:
Hope this helps..
Princy.
Try the following code snippet to achieve the desired scenario.
ASPX:
| <rad:GridTemplateColumn HeaderText="Status" UniqueName="Status" DataField="Status" > |
| <ItemTemplate> |
| <asp:Label ID="Label2" runat="server" Text=' <%#Eval("Status") %>' ></asp:Label> |
| </ItemTemplate> |
| <EditItemTemplate> |
| <asp:DropDownList ID="DropDownList2" runat="server"> |
| <asp:ListItem Text="YES" ></asp:ListItem> |
| <asp:ListItem Text="NO" ></asp:ListItem> |
| <asp:ListItem Text="NOT SURE" ></asp:ListItem> |
| </asp:DropDownList> |
| </EditItemTemplate> |
| </rad:GridTemplateColumn> |
CS:
| protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
| { |
| if (e.Item is GridDataItem) |
| { |
| GridDataItem item = (GridDataItem)e.Item; |
| Label lbl = (Label)item["Status"].FindControl("Label2"); |
| string strxt = lbl.Text.ToString(); |
| if (strxt == "1") |
| { |
| item["Status"].Text = "YES"; |
| } |
| else if (strxt == "0") |
| { |
| item["Status"].Text = "NO"; |
| } |
| else |
| item["Status"].Text = "NOT SURE"; |
| } |
| } |
Hope this helps..
Princy.