Welcome Guest Search | Active Topics | Sign In | Register

Grid ItemCommand - get value of cell in same row Options
Phil
Posted: Thursday, May 5, 2011 12:33:36 PM
Rank: Advanced Member
Groups: Member

Joined: 11/16/2010
Posts: 48
I have Edit buttons on the rows of my grid. When one is clicked he .ItemCommand event fires and I get an item object

Server side, how can I get the value of a cell, say column(0), in the same row as the Edit button that was clicked?
Phil
Posted: Thursday, May 5, 2011 12:58:29 PM
Rank: Advanced Member
Groups: Member

Joined: 11/16/2010
Posts: 48
OK found it - use the KeyField (and remember not to repopulate on postback!)
Thanks for your responsive service.. I just wish your documentation was a little easier to follow.
eo_support
Posted: Thursday, May 5, 2011 1:38:26 PM
Rank: Administration
Groups: Administration

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

This property might be more straight forward for your case:

http://doc.essentialobjects.com/library/1/eo.web.griditem.cells.aspx

Complete class reference is available both online and on your local machine in .chm format. You can search and browse any way you want just like you do with other MS help files. It can't get easier to follow than that ---- you just have to look at it.

Thanks!
Gajanan
Posted: Friday, May 6, 2011 12:41:32 AM
Rank: Newbie
Groups: Member

Joined: 5/6/2011
Posts: 2
Hi Good Morning. This is Gajanan
My question is i want to compare all grid cell using java script that i write the code following. Please help me on that i am not getting that ClientSideBeginEdit.





<eo:Grid ID="gvDepositIntSet" runat="server" BorderColor="#C7D1DF" BorderWidth="1px"
ClientSideOnItemCommand="OnItemDelete" ClientSideAfterEditItem="GetValues" ColumnHeaderAscImage="00050303"
ColumnHeaderDescImage="00050304" ColumnHeaderDividerImage="00050302" FixedColumnCount="1"
Font-Bold="False" Font-Italic="False" Font-Names="Verdana" Font-Overline="False"
Font-Size="9pt" Font-Strikeout="False" Font-Underline="False" GridLineColor="199, 209, 223"
GridLines="Both" Height="200px" Width="990px" AllowNewItem="True" GoToBoxVisible="True"
FullRowMode="False">
<FooterStyle CssText="padding-bottom:4px;padding-left:4px;padding-right:4px;padding-top:4px;" />
<ColumnHeaderStyle CssClass="tdblue " />
<ItemStyles>
<eo:GridItemStyleSet>
<AlternatingItemStyle CssText="background-color: #E0EEE0" />
<ItemStyle CssText="background-color: #FFFFFF" />
<EditSelectedStyle CssText="background-color: #C0D9AF" />
<ItemHoverStyle CssText="background-color: #C0D9AF" />
<SelectedStyle CssText="background-color: #C0D9AF" />
</eo:GridItemStyleSet>
</ItemStyles>
<%--<ItemStyles>
<eo:GridItemStyleSet>
<ItemStyle CssText="background-color: white" />
<ItemHoverStyle CssText="background-image: url(00050206); background-repeat: repeat-x" />
<SelectedStyle CssText="background-image: url(00050207); background-repeat: repeat-x" />
<CellStyle CssText="padding-left:8px;padding-top:2px; color:#336699;white-space:nowrap;" />
</eo:GridItemStyleSet>
</ItemStyles>--%>
<ColumnTemplates>
<eo:TextBoxColumn>
<TextBoxStyle CssText="BORDER-RIGHT: #7f9db9 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #7f9db9 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 8.75pt; PADDING-BOTTOM: 1px; MARGIN: 0px; BORDER-LEFT: #7f9db9 1px solid; PADDING-TOP: 2px; BORDER-BOTTOM: #7f9db9 1px solid; FONT-FAMILY: Tahoma" />
</eo:TextBoxColumn>
<eo:DateTimeColumn>
<DatePicker ControlSkinID="None" DayCellHeight="16" runat="server" DayCellWidth="19"
DayHeaderFormat="FirstLetter" DisabledDates="" OtherMonthDayVisible="True" SelectedDates=""
TitleLeftArrowImageUrl="DefaultSubMenuIconRTL" TitleRightArrowImageUrl="DefaultSubMenuIcon">
<TodayStyle CssText="font-family: tahoma; font-size: 12px; border-right: #bb5503 1px solid; border-top: #bb5503 1px solid; border-left: #bb5503 1px solid; border-bottom: #bb5503 1px solid" />
<SelectedDayStyle CssText="font-family: tahoma; font-size: 12px; background-color: #fbe694; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
<DisabledDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
<PickerStyle CssText="border-bottom-color:#7f9db9;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#7f9db9;border-left-style:solid;border-left-width:1px;border-right-color:#7f9db9;border-right-style:solid;border-right-width:1px;border-top-color:#7f9db9;border-top-style:solid;border-top-width:1px;font-family:Courier New;font-size:8pt;margin-bottom:0px;margin-left:0px;margin-right:0px;margin-top:0px;padding-bottom:1px;padding-left:2px;padding-right:2px;padding-top:2px;" />
<CalendarStyle CssText="background-color: white; border-right: #7f9db9 1px solid; padding-right: 4px; border-top: #7f9db9 1px solid; padding-left: 4px; font-size: 9px; padding-bottom: 4px; border-left: #7f9db9 1px solid; padding-top: 4px; border-bottom: #7f9db9 1px solid; font-family: tahoma" />
<TitleArrowStyle CssText="cursor:hand" />
<DayHoverStyle CssText="font-family: tahoma; font-size: 12px; border-right: #fbe694 1px solid; border-top: #fbe694 1px solid; border-left: #fbe694 1px solid; border-bottom: #fbe694 1px solid" />
<MonthStyle CssText="font-family: tahoma; font-size: 12px; margin-left: 14px; cursor: hand; margin-right: 14px" />
<TitleStyle CssText="background-color:#9ebef5;font-family:Tahoma;font-size:12px;padding-bottom:2px;padding-left:6px;padding-right:6px;padding-top:2px;" />
<OtherMonthDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
<DayHeaderStyle CssText="font-family: tahoma; font-size: 12px; border-bottom: #aca899 1px solid" />
<DayStyle CssText="font-family: tahoma; font-size: 12px; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
</DatePicker>
</eo:DateTimeColumn>
<eo:MaskedEditColumn>
<MaskedEdit ControlSkinID="None" runat="server" TextBoxStyle-CssText="BORDER-RIGHT: #7f9db9 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #7f9db9 1px solid; PADDING-LEFT: 2px; PADDING-BOTTOM: 1px; MARGIN: 0px; BORDER-LEFT: #7f9db9 1px solid; PADDING-TOP: 2px; BORDER-BOTTOM: #7f9db9 1px solid; font-family:Courier New;font-size:8pt;">
</MaskedEdit>
</eo:MaskedEditColumn>
</ColumnTemplates>
<Columns>
<eo:RowNumberColumn HeaderText="No" Name="No" Width="60" Visible="false">
</eo:RowNumberColumn>
<eo:DateTimeColumn DataField="effectivedate" HeaderText="Select Date" Name="Date">
<DatePicker DayCellHeight="16" SelectedDates="" DisabledDates="" OtherMonthDayVisible="True"
runat="server" DayHeaderFormat="FirstLetter" TitleLeftArrowImageUrl="DefaultSubMenuIconRTL"
TitleRightArrowImageUrl="DefaultSubMenuIcon" DayCellWidth="19" ControlSkinID="None">
<TodayStyle CssText="font-family: tahoma; font-size: 12px; border-right: #bb5503 1px solid; border-top: #bb5503 1px solid; border-left: #bb5503 1px solid; border-bottom: #bb5503 1px solid">
</TodayStyle>
<SelectedDayStyle CssText="font-family: tahoma; font-size: 12px; background-color: #fbe694; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid">
</SelectedDayStyle>
<DisabledDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid">
</DisabledDayStyle>
<PickerStyle CssText="font-family:Courier New; padding-left:5px; padding-right: 5px;">
</PickerStyle>
<CalendarStyle CssText="background-color: white; border-right: #7f9db9 1px solid; padding-right: 4px; border-top: #7f9db9 1px solid; padding-left: 4px; font-size: 9px; padding-bottom: 4px; border-left: #7f9db9 1px solid; padding-top: 4px; border-bottom: #7f9db9 1px solid; font-family: tahoma">
</CalendarStyle>
<TitleArrowStyle CssText="cursor:hand"></TitleArrowStyle>
<DayHoverStyle CssText="font-family: tahoma; font-size: 12px; border-right: #fbe694 1px solid; border-top: #fbe694 1px solid; border-left: #fbe694 1px solid; border-bottom: #fbe694 1px solid">
</DayHoverStyle>
<MonthStyle CssText="font-family: tahoma; font-size: 12px; margin-left: 14px; cursor: hand; margin-right: 14px">
</MonthStyle>
<TitleStyle CssText="background-color:#9ebef5;font-family:Tahoma;font-size:12px;padding-bottom:2px;padding-left:6px;padding-right:6px;padding-top:2px;">
</TitleStyle>
<OtherMonthDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid">
</OtherMonthDayStyle>
<DayHeaderStyle CssText="font-family: tahoma; font-size: 12px; border-bottom: #aca899 1px solid">
</DayHeaderStyle>
<DayStyle CssText="font-family: tahoma; font-size: 12px; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid">
</DayStyle>
</DatePicker>
</eo:DateTimeColumn>
<%--<eo:TextBoxColumn HeaderText="From Month" Name="From Month" DataField="FROMMONTH"
Width="100" ClientSideBeginEdit="check_all">
</eo:TextBoxColumn>--%>
<eo:TextBoxColumn HeaderText="Period(No Month)" Name="Period" DataField="TOMONTH"
Width="150">
</eo:TextBoxColumn>
<eo:TextBoxColumn HeaderText="Rate of Interest" Name="Rate of Interest" DataField="RATE"
Width="150" ClientSideBeginEdit="check_allcell">
</eo:TextBoxColumn>
<%--<eo:ButtonColumn ButtonType="LinkButton" ButtonText="<img alt='Delete'src='../Images/Delete.gif' />"
Width="60" HeaderText="Delete" Name="Delete">
</eo:ButtonColumn>--%>
<eo:DeleteCommandColumn HeaderText="Delete" Name="Delete" Width="100">
</eo:DeleteCommandColumn>
<eo:StaticColumn DataField="SEQ_ID" HeaderText="SEQ_ID" Name="SEQ_ID" Visible="false">
</eo:StaticColumn>
</Columns>


</eo:Grid>
<table>
<tr>
<td>
<asp:Button ID="btnSaveChanges" runat="server" Text="Save Changes" />
</td>
<td>
<asp:Button ID="btnBack" runat="server" Text="Back" />
</td>
</tr>
</table>

Java Script
function check_allcell(cell)

{

var grid = eo_GetObject("gvDepositIntSet");
var index = cell.getItemIndex();
//var selectedItem = MASTER_MAIN_bodycontent_bodysubcontent_gvDepositIntSet.getItem(index);
var selectedItem = grid.getItem(index);
var strDate = selectedItem.getCell(1).getValue().format('dd/MM/yyyy');
var strFromMonth = selectedItem.getCell(2).getValue();
var strInterest =selectedItem.getCell(3).getValue();
var count =0;
//alert(strDate);
for (var i = 0; i < grid.getItemCount(); i++)
{
var gridItem = grid.getItem(i);
var gcDate = gridItem.getCell(1).getValue().format('dd/MM/yyyy');
var gcMonth = gridItem.getCell(2).getValue();
var gcInterest = gridItem.getCell(3).getValue();

//alert(gridCell.format('dd/MM/yyyy'));

if (gcDate == strDate && gcMonth == strFromMonth && gcInterest == strInterest)
{//alert(i);
count++;
}
}
alert(count);
if (count>1)//
{
alert("Check Interest Rate ") ;
//selectedItem.getCell(1).setValue=null;
}

}



















































































eo_support
Posted: Friday, May 6, 2011 7:34:35 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
To Gajanan:

We tested your code and it works fine.

In the future please create a new thread for your own question. Do not follow other question thread unless you have exactly the same question.

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.