checking status of a value in a radgrid [Resolved]

Posted by Jopito under ASP.NET on 10/16/2013 | Points: 10 | Views : 1595 | Status : [Member] | Replies : 6
Hi pals,i have values in my radgrid where the datasource its from a web service,The columns are bound to the data in from the database,I have a field name "Status Id" and its based an values like 1 and 2 ,I need it to show either Active or Inactive .If the status is 1,instead of showing "1" it should show "Active" and if status Id is "2",then it should show "Inactive".am using c# in my program.

Thanks

Mark as answer if satisfied


Responses

Posted by: Nismeh on: 10/18/2013 [Member] Starter | Points: 50

Up
0
Down

Resolved
Hi,
Plz go through following code. This must help you to achieve your goal.

private void RadGPozycje_ItemDataBound(object sender, GridItemEventArgs e)
{
GridDataItem item;
item = e.Item as GridDataItem;
if (item["Vat"].Text == "-1")
item["Vat"].Text = "zw";
}

Plz mark it as ans if you find it helpful to step up ahead. :)

IT KNOWLEDGE IS APPLIED KNOWLEDGE
So Just Do It

Jopito, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nismeh on: 10/18/2013 [Member] Starter | Points: 25

Up
0
Down
Hi,

You shown that what you want. But didnt asked about your confusion. Can you plz elaborate this?


IT KNOWLEDGE IS APPLIED KNOWLEDGE
So Just Do It

Jopito, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jopito on: 10/18/2013 [Member] Starter | Points: 25

Up
0
Down
I am using soap UI service method to bind data with my radgrid,I have got customer details in my db and am querying data from it,Their is a field called "IP STATUS" in the SOAPUI whereby in the (customer details WHICH IS THE NAME OF MY DB) its either 1 or 2,If the Status is 1,then in the radgrid should show "Active " but not
"1" in the radgrid as the current situation.If its "2",then it the status should be "INACTIVE" showing in the radgrid......I hope you got a clear picture of how i require it now

Thank you

Mark as answer if satisfied

Jopito, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jopito on: 10/18/2013 [Member] Starter | Points: 25

Up
0
Down
Please guide me on your code Nismeh,i cant get well the values (item)item means my columns or what please?Thank you


Mark as answer if satisfied

Jopito, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nismeh on: 10/18/2013 [Member] Starter | Points: 25

Up
0
Down
item["Val"]

Items consider as your virtual table. And Val as your column name
Like in Employee table we are having Employee_Name so
item["Employee_Name"]

IT KNOWLEDGE IS APPLIED KNOWLEDGE
So Just Do It

Jopito, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jopito on: 10/19/2013 [Member] Starter | Points: 25

Up
0
Down
This is the error am getting after adding the item databound event

" Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1061: 'ASP.addnewip_aspx' does not contain a definition for 'manageIpRadgrid_ItemDataBound1' and no extension method 'manageIpRadgrid_ItemDataBound1' accepting a first argument of type 'ASP.addnewip_aspx' could be found (are you missing a using directive or an assembly reference?)

Source Error:


Line 61: <br />
Line 62: <br />
Line 63: <telerik:RadGrid ID="manageIpRadgrid" runat="server" AutoGenerateColumns="False" CellSpacing="0" CssClass="auto-style1" GridLines="None" OnNeedDataSource="RadGrid1_NeedDataSource" OnEditCommand="RadGrid1_EditCommand" OnItemCreated="RadGrid1_ItemCreated" OnItemInserted="RadGrid1_ItemInserted" OnInsertCommand="RadGrid1_InsertCommand" OnItemCommand="RadGrid1_ItemCommand" PageSize="15" Width="741px" OnItemDataBound="manageIpRadgrid_ItemDataBound1">
Line 64: <MasterTableView AutoGenerateColumns="false">
Line 65: <EditFormSettings InsertCaption="Add new item" CaptionFormatString="Edit EmployeeID: {0}"

Mark as answer if satisfied

Jopito, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response