C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Interview   Jobs   Projects   Offshore Development    
Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing | Talk to Us |



My Profile

Gifts

Active Members
TodayLast 7 Days more...







To sujit kumar


Posted Date: 05 Jul 2008      Total Responses: 1

Posted By: sathya       Member Level: Gold     Points: 1



hai,
thanks for ur reply,soory for the disturb

if u don't mine small example code


but my problem:i used one textbox.(if i will put city or education or name)
any field i will type textbox;imm this value pass to the next page using response.redirect

select * from tablename where name like '%textbox1%' or city like '%textbox1%' or education like '%textbox1%'"

Response.Redirect("keyview.aspx?id=" & a & " & name=" & Request.Form("TextBox1.Text") & " & city=" & Request.Form("textbox1")" & education=" & Request.Form("textbox1")))

so what to do?

how to pass the value

pl give me reply




Responses

Author: Sujit Kumar    05 Jul 2008Member Level: GoldRating:     Points: 6
Hi,

you can do like:
//aspx page

<div>
<asp:TextBox ID="txtName" runat="server"></asp:TextBox>
<br />
<asp:TextBox ID="txtCity" runat="server"></asp:TextBox>
<br />
<asp:TextBox ID="txtEdu" runat="server"></asp:TextBox>
<br />
<asp:Button ID="btnShow" runat="server" Text="Show" onclick="btnShow_Click" />
<asp:GridView ID="gv" runat="server"></asp:GridView>
</div>

//.cs page
SqlConnection con;
SqlDataAdapter da;
DataSet ds=new DataSet();

protected void Page_Load(object sender, EventArgs e)
{

}
public void show(string name,string city,string edu)
{
con = new SqlConnection("Data Source=sujitkumar\\sqlexpress;Initial Catalog=pubs;Integrated Security=SSPI");
String query = "select * from student where name='" + name + "' or city='" + city + "' or education='" + edu + "'";
da = new SqlDataAdapter(query, con);
da.Fill(ds);
gv.DataSource = ds;
gv.DataBind();
string url = "default2.aspx?name=" + ds.Tables[0].Rows[0]["name"].ToString() + "&city=" + ds.Tables[0].Rows[0]["city"].ToString() + "&education=" + ds.Tables[0].Rows[0]["education"].ToString();
}
protected void btnShow_Click(object sender, EventArgs e)
{
show(txtName.Text.Trim(), txtCity.Text.Trim(), txtEdu.Text.Trim());

}



Post Reply
You must Sign In to post a response.
Next : download file
Previous : Send mail........
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

web conferencing services

Contact Us    Privacy Policy    Terms Of Use