Hi,
I am in the middle doing my school work however i having some error with my code but i run this similar code in my other file and there is no issue. Hope you guys can help me. It's about getting multi datakeyname
I not sure why this error happen upon loading of the page i got this error
I am in the middle doing my school work however i having some error with my code but i run this similar code in my other file and there is no issue. Hope you guys can help me. It's about getting multi datakeyname
Code:
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="false" Width="100%" AllowPaging="true" OnPageIndexChanging="OnPageIndexChanging2" PageSize="3" CssClass="Grid" DataKeyNames="id, tripidtaking, reqid" > <Columns> <asp:BoundField DataField="fname" /> <asp:BoundField DataField="startptname" HeaderText="Origin" /> <asp:BoundField DataField="endptname" HeaderText="Destination" /> <asp:BoundField DataField="givendate" HeaderText="Date" /> <asp:BoundField DataField="starttime" HeaderText="Agreed Time" /> <asp:BoundField DataField="numperson" HeaderText="NoOfPpl" /> <asp:BoundField DataField="Recurring" HeaderText="Whether Recurring" /> <asp:BoundField DataField="day" HeaderText="Selected Day" /> <asp:BoundField DataField="usertype" HeaderText="Type" /> <asp:BoundField DataField="Cfname" HeaderText="Driver Name" /> <asp:BoundField DataField="cid" HeaderText="Driver ID" /> <asp:BoundField DataField="" HeaderText="" /> <asp:BoundField DataField="" HeaderText="" /> </Columns> </asp:GridView>
Protected Sub GridView2_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView2.RowDataBound
Dim row As GridViewRow = e.Row
If row.RowType = DataControlRowType.DataRow Then
'Below 1 is userid, remember to change to userid variable
If row.Cells(10).Text = reqid Then
Dim lb As New LinkButton()
lb.ID = "lbEnd"
lb.Text = "End"
lb.CommandName = "EndRow"
lb.CommandArgument = DataBinder.Eval(row.DataItem, "tripidtaking") + "," + DataBinder.Eval(row.DataItem, "reqid")
row.Cells(12).Controls.Add(lb)
ElseIf row.Cells(10).Text <> reqid Then
End If
End If
End Sub