Welcome Guest Search | Active Topics | Sign In | Register

Reading from Custom Column in the grid Options
Rashmi
Posted: Thursday, October 9, 2008 4:03:20 AM
Rank: Member
Groups: Member

Joined: 9/9/2008
Posts: 7
Hi,

Following is my code in aspx page -

<Columns>
<eo:RowNumberColumn Width="40">
</eo:RowNumberColumn>
<eo:TextBoxColumn DataField="FirstName" HeaderText=" First Name" Width="125">
</eo:TextBoxColumn>
<eo:TextBoxColumn DataField="MiddleName" HeaderText=" Middle Name" Width="125">
</eo:TextBoxColumn>
<eo:TextBoxColumn DataField="LastName" HeaderText=" Last Name" Width="125">
</eo:TextBoxColumn>
<eo:CustomColumn Width="125" ClientSideBeginEdit="on_begin_edit_other" ClientSideEndEdit="on_end_edit_other" HeaderText=" Relation">
<EditorTemplate>
<select id="ddlOtherRelationshipType">
<option value="0">--- Select ---</option>
<asp:Repeater ID="RelationshipType" runat="server">
<ItemTemplate>
<option value='<%#DataBinder.Eval(Container.DataItem, "ID")%>'>
<%#DataBinder.Eval(Container.DataItem, "Name")%>
</option>
</ItemTemplate>
</asp:Repeater>
</select>
</EditorTemplate>
</eo:CustomColumn>

<eo:StaticColumn DataField="ID" Width="0">
</eo:StaticColumn>
</Columns>
<ColumnHeaderStyle CssText="background-image:url('00050101');padding-left:8px;padding-top:3px;" />
</eo:Grid>

Following is my code in .aspx.cs page -

foreach (EO.Web.GridItem item in gdOtherMembers.Items)
{
if (item.Cells[1].Value == null) item.Cells[1].Value = string.Empty;
if (item.Cells[2].Value == null) item.Cells[2].Value = string.Empty;
if (item.Cells[3].Value == null) item.Cells[3].Value = string.Empty;
if (item.Cells[4].Value == null) item.Cells[4].Value = string.Empty;

if ((item.Cells[1].Value.ToString().Trim() != "") && (item.Cells[1].Value.ToString() != String.Empty))
{

carerFamilyData = new CarerFamilyDTO();

carerFamilyData.FirstName = item.Cells[1].Value.ToString();
carerFamilyData.MiddleName = item.Cells[2].Value.ToString();
carerFamilyData.LastName = item.Cells[3].Value.ToString();
carerFamilyData.DateOfBirth = string.Empty;
carerFamilyData.RelationshipTypesID = int.Parse(item.Cells[4].Value.ToString());

carerFamilyData.IsLivingAtHome = false;

if (item.Cells[5].Value != null)
carerFamilyData.ID = int.Parse(item.Cells[5].Value.ToString());
else
carerFamilyData.ID = 0;

familyList.Add(carerFamilyData);
}
}

where gdOtherMembers is the grid, carerFamilyData is a DTO class and familyList is an arraylist.

When the relationship is selected from the 4th column in the grid, ID of the selected option should be retrieved but it is retrieving the selected data. It is giving an error in the following line -

carerFamilyData.RelationshipTypesID = int.Parse(item.Cells[4].Value.ToString());

Kindly help me out.

Thanks,
Rashmi
eo_support
Posted: Thursday, October 9, 2008 6:45:51 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Your code looks fine to me. You will want to debug on_end_edit_other and see what value that function returns. item.Cells[x].Value contains the same value you returned from that function.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.