ASP .net DataNavigateUrlFormatString

StudentRegistrationDetails.aspx.cs page:

String StudentId = Request.Params["StudentId"].ToString();
String TermId = Request.Params["TermId"].ToString();

.aspx file

<asp:GridView ID="GridView1" Width="580px" runat="server" AutoGenerateColumns="False"
EmptyDataText="No more student available" GridLines="None" AllowPaging="False"
AllowSorting="True" CssClass="mGrid" PagerStyle-CssClass="pgr" AlternatingRowStyle-CssClass="alt">
<Columns>
<asp:HyperLinkField DataNavigateUrlFields="StudentId,TermId" HeaderText="Details" NavigateUrl="StudentRegistrationDetails.aspx"
ShowHeader="False" Text="Details" DataNavigateUrlFormatString="StudentRegistrationDetails.aspx?StudentId={0}&&TermId={1}">
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<HeaderStyle HorizontalAlign="Center" />
</asp:HyperLinkField>
<asp:TemplateField HeaderText="Roll">
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<HeaderStyle HorizontalAlign="Center" />
<ItemTemplate>
<asp:Label ID="lblStudentId" runat="server" Text='<% #Eval("StudentId") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="StudentsName" HeaderText="Name" />
<asp:TemplateField HeaderText="Term">
<ItemStyle HorizontalAlign="Center" Width="100px" />
<HeaderStyle HorizontalAlign="Center" Width="100px" />
<ItemTemplate>
<asp:Label ID="lblTermName" runat="server" Text='<% #Eval("TermName") %>'></asp:Label>
<asp:Label Visible="false" ID="lblTermId" runat="server" Text='<% #Eval("TermId") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="AdvisorId" HeaderText="Advisor" />
<asp:BoundField DataField="CreditTaken" HeaderText="Credit" />
<asp:TemplateField HeaderText="Select">
<ItemStyle HorizontalAlign="Center" Width="50px" />
<HeaderStyle HorizontalAlign="Center" Width="50px" />
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" />
<asp:HiddenField ID="hdnStudentId" Value='<% #Eval("StudentId") %>' runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s