TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Guest User
Tech Writer
271
36.2k
join 2 tables bind in dropdown in asp.net
Oct 14 2020 7:29 AM
hi Experts,
my scenario is i have two different tables and i want bind in dropdown according to user Id....
<body>
<form id=
"form1"
runat=
"server"
>
<div>
<table>
<tr>
<td>Security Question1</td>
<td>
<asp:DropDownList ID=
"ddlQuestion"
runat=
"server"
AppendDataBoundItems=
"true"
>
</asp:DropDownList>
<asp:TextBox ID=
"TxtAnswer"
runat=
"server"
></asp:TextBox>
</td>
<tr>
<td>
<asp:Button ID=
"btnSubmit"
runat=
"server"
Text=
"Submit"
OnClick=
"btnSubmit_Click"
/>
</td>
</tr>
<tr>
<td>
<asp:Label ID=
"lblerror"
runat=
"server"
></asp:Label>
</td>
</tr>
</table>
</div>
</form>
</body>
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!IsPostBack)
{
bindSecQue();
}
}
private
void
bindSecQue()
{
using
(schoolEntities6 context =
new
schoolEntities6())
{
List<SecurityModel> newlist = (from c
in
context.SecurityQuestionDetails
join sq
in
context.SecurityQuestions on c.SecQueId equals sq.Id
where c.UserId == Id
select
new
SecurityModel
{
Id = c.Id,
SecQue = sq.SecQue,
SecQue2 = sq.SecQue2,
SecQueId = c.SecQueId
}).ToList();
ddlQuestion.DataTextField =
"SecQue"
;
ddlQuestion.DataValueField =
"SecQueId"
;
ddlQuestion.DataBind();
ddlQuestion.Items.Insert(0,
new
System.Web.UI.WebControls.ListItem(
"Select"
));
}
}
I am using this scenario but didn't show any data in frontend...and when I give static UserId == 1..it's showing...
Reply
Answers (
2
)
Hi! i need master detail page in asp.net core!
Friends can you suggest a good laptop