Entity Framework ASP.NET CRUD -
i have student page , student insert, delete, update. have page course course insert, delete, update.now want student assign courses. clear? should see in page?can me?
you can add hyperlink on student page called "assign courses" or similar:
<asp:gridview id="gvstudents" runat="server" autogeneratecolumns="false"> <columns> <asp:boundfield datafield="name" /> <asp:boundfield datafield="surname" /> <asp:hyperlinkfield datanavigateurlfields="name,surname,id" datanavigateurlformatstring="assigncourses.aspx?name={0}&surname={1}&id={2}" text="assigncourses" /> </columns> </asp:gridview>
clicking on hyperlink take user new page called assigncourses.aspx , pass through name,surname , id(or other field like) in query string.
on assigncourses.aspx write code display list of courses assigned student.also, have drop down listing other courses.if user clicks on assign course button use course id , student id (from query string) assign student course.
reading values query string on assigncourses.aspx page:
string name = request.querystring["name"].tostring(); string surname = request.querystring["surname"].tostring(); int id = convert.toint32(request.querystring["id"]); lblinfo.text = string.format("assign courses - {0} {1}", name, surname);
edit:
if you're using asp.net mvc can add hyperlink assigncourses view using razor syntax, this:
@html.actionlink("click here assign course", "assigncoursesaction", "putcontrollernamehere", new { id=student.id }, null)
Comments
Post a Comment