Welcome Guest Search | Active Topics | Sign In | Register

Edit after sorting by non-unique column Options
John Foley
Posted: Sunday, October 21, 2012 1:03:10 AM
Rank: Member
Groups: Member

Joined: 9/6/2008
Posts: 29
I am running a grid control on the client side. I have a few pages of data with sortable columns that hold non-unique data. If I sort by a column, modify data in a textbox cell and postback to update the row, the changedItems element does not point to the correct row, it points to a different row. Am I unable to use the grid to update data after I have sorted by a column with non-unique data?
eo_support
Posted: Sunday, October 21, 2012 1:14:42 PM
Rank: Administration
Groups: Administration

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

Whether your data are unique shouldn't matter. Please try the latest build to see if you still have this problem. If you still have problems, please try to isolate the problem into a test page, then post the test page. Once we have that we will be happy to take a look.

Thanks!
John Foley
Posted: Sunday, October 21, 2012 4:40:00 PM
Rank: Member
Groups: Member

Joined: 9/6/2008
Posts: 29
I am now using the latest build. Here is a link you can go to which demonstrates the issue. (I am bypassing the update and just displaying what would be updated). It must be a stupid mistake in my process so it may be a simple answer for you. I am sorting and updating on the client, an I causing a sort to occur on the server side prior to my update routine when I post back?

http://test.sportsincollege.com/TTAthletes.aspx?tid=NASACL

1. I click on the "Grad" setting twice to sort by grad year descending. (My first three athletes in 2025 are Sara, Graysen, Eliana)
2. I clicked in the grad year column to bring up the text box for Sara, Graysen, Eliana and Autumn.
3. I click the "Save Updates" button
4. My message displays Sara, Autumn, Caroline, Grayson. (The grid has resorted and they are now the first four athletes in 2025. I don' t know why it resorted, I assume that is what is causing the issue.)

My Grid is defined as:

<eo:Grid runat="server" id="eoGrid" BorderColor="#000000" BorderWidth="0px" GridLines="Horizontal" GoToBoxVisible="True"
AllowPaging="true" PageSize="100" KeyField="athid" ScrollBars="None"
ColumnHeaderDescImage="00050205" GridLineColor="#999999" Width="975px" allownewitem="false"
IsCallbackByMe="False" ColumnHeaderAscImage="00050204" ColumnHeaderHeight="24" AllowColumnReorder="true"
ItemHeight="20" Font-Size="8pt" Font-Names="Arial" FullRowMode="False" ForceSSL="False">
<ItemStyles>
<eo:GridItemStyleSet>
<SelectedStyle CssText="background-image: url(00050207); background-repeat: repeat-x; background-position:bottom;"></SelectedStyle>
<CellStyle CssText="padding-top:2px;padding-bottom:2px;"></CellStyle>
<ItemStyle CssClass="eorow" />
<AlternatingItemStyle CssClass="eoaltrow" />
<ItemHoverStyle CssText="background-image: url(00050207);background-repeat: repeat-x; background-position:bottom;" CssClass="eorow" />
</eo:GridItemStyleSet>
</ItemStyles>
<ContentPaneStyle CssText="border:0;"></ContentPaneStyle>
<Columns>
<eo:TextBoxColumn HeaderText="No." DataField="num" AllowSort="True" Width="25"/>
<eo:textboxColumn HeaderText="First" DataField="first" AllowSort="True" Width="100" />
<eo:TextBoxColumn HeaderText="Last" DataField="last" AllowSort="True" Width="100" />
<eo:TextBoxColumn HeaderText="Email" DataField="email" AllowSort="True" Width="250" />
<eo:TextBoxColumn HeaderText="Phone" DataField="phone" AllowSort="True" Width="100" />
<eo:DateTimeColumn HeaderText="Birthdate" DataField="birthdate" AllowSort="True" Width="100" />
<eo:TextBoxColumn HeaderText="Grad" DataField="graduation" AllowSort="True" Width="50" />
<eo:TextBoxColumn HeaderText="Position" DataField="position" AllowSort="True" Width="100" />
<eo:TextBoxColumn HeaderText="T-Shirt" DataField="tshirt" visible="false" />
<eo:TextBoxColumn HeaderText="School" DataField="highschool" AllowSort="True" Width="150" />
<eo:TextBoxColumn HeaderText="" DataField="pending" visible="false" />
<eo:TextBoxColumn HeaderText="" DataField="certified" visible="false" />
<eo:TextBoxColumn HeaderText="" DataField="athid" visible="false" />
</Columns>

My "Save" button is:

<asp:Button runat="server" ForeColor="Black" ID="BtnUpdate" Font-Size="9pt" Text="Save Updates" OnClick="btnSaveAthletes_Clicked" CssClass="css3button"></asp:Button>

My server code is:

Sub btnSaveAthletes_Clicked(ByVal sender As Object, ByVal e As EventArgs)

updateRosterChanges()

If lblErrorMessage.Text > "" Then
lblErrorMessage.Text += "<br />Correct the above error(s) to complete your update."
Else
Response.Redirect("TTAthletes.aspx?" & Request.QueryString.ToString())
End If

End Sub

Sub updateRosterChanges()

lblErrorMessage.Text = ""

Dim changes As Boolean
Dim itm As EO.Web.GridItem, cel As EO.Web.GridCell

Try

'modified
For Each itm In eoGrid.ChangedItems
changes = False
For Each cel In itm.Cells
If cel.Modified Then
If Not cel.Value Is Nothing Then
If Not changes Then
If athlete.SelectAthlete(itm.Key) = 0 Then
lblErrorMessage.Text += itm.Key & " read failed<br />"
End If
End If
Select Case cel.Column.DataField
Case "num"
If ValidNumber(cel.Value) Then
athlete.number = cel.Value
Else
lblErrorMessage.Text += athlete.name & " " & cel.Column.DataField & " edit invalid: " & cel.Value & "<br />"
End If
Case "first"
If Len(Trim(cel.Value)) < 26 Then
athlete.firstname = Trim(cel.Value)
Else
lblErrorMessage.Text += athlete.name & " " & cel.Column.DataField & " edit invalid: " & cel.Value & "<br />"
End If
Case "last"
If Len(Trim(cel.Value)) < 36 Then
athlete.lastname = Trim(cel.Value)
Else
lblErrorMessage.Text += athlete.name & " " & cel.Column.DataField & " edit invalid: " & cel.Value & "<br />"
End If
Case "email"
If ValidEmail(cel.Value) Then
athlete.email = cel.Value
Else
lblErrorMessage.Text += athlete.name & " " & cel.Column.DataField & " edit invalid: " & cel.Value & "<br />"
End If
Case "phone"
If ValidPhone(cel.Value) Then
athlete.phone = cel.Value
Else
lblErrorMessage.Text += athlete.name & " " & cel.Column.DataField & " edit invalid: " & cel.Value & "<br />"
End If
Case "birthdate"
If IsDate(cel.Value) Then
athlete.birthdate = cel.Value
Else
lblErrorMessage.Text += athlete.name & " " & cel.Column.DataField & " edit invalid: " & cel.Value & "<br />"
End If
Case "graduation"
If Val(cel.Value) > 2010 And Val(cel.Value) < 2030 Then
athlete.graduation = cel.Value
Else
lblErrorMessage.Text += athlete.name & " " & cel.Column.DataField & " edit invalid: " & cel.Value & "<br />"
End If
Case "position"
If Len(Trim(cel.Value)) < 21 Then
athlete.position = cel.Value
Else
lblErrorMessage.Text += athlete.name & " " & cel.Column.DataField & " edit invalid: " & cel.Value & "<br />"
End If
Case "tshirt"
If Len(Trim(cel.Value)) < 21 Then
athlete.custom4 = cel.Value
Else
lblErrorMessage.Text += athlete.name & " " & cel.Column.DataField & " edit invalid: " & cel.Value & "<br />"
End If
Case "highschool"
If Len(Trim(cel.Value)) < 26 Then
athlete.highSchool = cel.Value
Else
lblErrorMessage.Text += athlete.name & " " & cel.Column.DataField & " edit invalid: " & cel.Value & "<br />"
End If
End Select
changes = True
End If
End If
Next

If changes Then
'If athlete.UpdateAthlete(lblStaff.Text) < 1 Then
'lblErrorMessage.Text += athlete.athid & " update failed<br />"
'End If
lblErrorMessage.Text += "Updated " & athlete.name & "<br />"
End If

Next

Catch ex As Exception

lblErrorMessage.Text += athlete.name & " " & ex.Message & "<br />"

End Try


End Sub
eo_support
Posted: Sunday, October 21, 2012 11:08:07 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
We won't troubleshoot or review your code. So if it's a mistake in your code, we won't tell you what it is even if we know it. ; ) You will have to track down the issue to the point where you have exhaused options on your end first. That usually means you will have to have removed all code that are related to your particular business scenario and you have produced a generic scenario that can demonstrate the problem. Because we offer our support for free, we have this policy to avoid our customers won't rely on us to troubleshoot their coding issues. Thanks for understanding.


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.