I have created a search box that is working fine, but I have a problem whereby I search a word and it appears everything on the database. What I really want it to do is to search for a specific word (title and content).Well on the 1st page(webform1.aspx) it works fine, but on the second page(entry.aspx) When i click a link after searching, it shows everything on the database and i don't want that to happen
DATABASE
DB name : mysearch
DB table : Blog
blogId
blogTitle
blogContents
webform1.aspx
search for something, man!
"><%# Server.HtmlEncode(Eval("BlogTitle").ToString())%>
<%#Eval("BlogContents")%>
Webform1.aspx.cs
protected void btnSubmit_Click(object sender, EventArgs e)
{
BlogDBDataContext db = new BlogDBDataContext();
dynamic q = from b in db.Blogs
where b.BlogContents.Contains(txtSearch.Text.Trim()) | b.BlogTitle.Contains(txtSearch.Text.Trim())
select b;
lv.DataSource = q;
lv.DataBind();
}
Entry.aspx
<%#Eval ("BlogTitle") %>
<%#Eval("BlogContents")%>
Entry.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
BlogDBDataContext db = new BlogDBDataContext();
dynamic q = from b in db.Blogs
select b;
lv.DataSource = q;
lv.DataBind();
}
i need help guys ASP please.
Guys the problem its on the entry page whenever i click a link on webform1 page after searching, it shows everything and i'm confused why is it like that.
Jitendra KumarPosted Jan 12, 2015, 6:10 AM
If any concern plz reply.
thokozani mlangeniPosted Jan 19, 2015, 3:43 AM
thokozani mlangeniPosted Jan 14, 2015, 3:09 AM
thokozani mlangeniPosted Jan 11, 2015, 10:50 PM
Jitendra KumarPosted Jan 11, 2015, 10:29 PM
Kindly share code file for better understanding.
thokozani mlangeniPosted Jan 11, 2015, 10:13 PM
It says: value cannot be null. Parameter name:text
Error(lv.Databind();)
Jitendra KumarPosted Jan 10, 2015, 9:56 PM
Using session and query string pass the value one to another page.
See link :-
http://www.codeproject.com/Articles/492397/State-Management-in-ASP-NET-Introduction
thokozani mlangeniPosted Jan 10, 2015, 7:45 PM
Thank you very much, great job. One more thing i can ask is how can i pass values from webform1.aspx to entry.aspx. For example whenever a user types on the textbox(webform1), therefore after typing & click search, it must pass values i search for to entry page(straight to entry.aspx) without viewing information from webform1. If you don't understand please let me know thank you.
Jitendra KumarPosted Jan 10, 2015, 2:06 AM
In Entry page you select record in blog.
dynamic q = from b in db.Blogs
select b;
Not filtering the record.
See attached file.
If any concern plz reply.