Hi, I am mani. I have a problem in display the data in datagrid. What i did is I am creating a form and in this form i created a 6 textboxes and one search button. whenever the user enter a text in textbox i retrieve the data from the database and displayed in the datagrid. The problem is when the user again enter the text in text box the datagrid is filled with new data and last data will be lost. But i want that newly searching data should be displayed in datagrid including the last searching data. This is my problem i sent last time to this portal. i got some answers. But using the DataTable i didnt get the answer. I write my code here. please tell me what is the wrong i did it in this. using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; public partial class AdvanceSearch : System.Web.UI.Page { SqlConnection con; SqlCommand cmd; SqlDataAdapter adptr; DataTable dt; DataView dv; protected void Page_Load(object sender, EventArgs e) { if (Session["mani"] == null) { dt = new DataTable(); Session["mani"] = dt; } else { dt = (DataTable)Session["mani"]; } dv = new DataView(dt); SearchResultGrid.DataSource = dv; SearchResultGrid.DataBind(); } protected void ButtonSearch_Click(object sender, EventArgs e) { con = new SqlConnection("Data Source=MVB;Initial Catalog=Communication; Integrated Security=True"); string select_query = "SELECT *FROM CommunicationDetails WHERE CommunicationId=@comid OR IssueType=@issue OR RegionName=@regname OR ApplicationName=@appname OR Descript=@Desc OR CommunicationDate=@comdate"; cmd = new SqlCommand(select_query, con); cmd.Parameters.Add("@comid", TextBoxCommunicationID.Text); cmd.Parameters.Add("@issue", TextIssueType.Text); cmd.Parameters.Add("@regname", TextBoxRegionName.Text); cmd.Parameters.Add("@appname", TextBoxApplicationName.Text); cmd.Parameters.Add("@Desc", TextBoxDescription.Text); cmd.Parameters.Add("@comdate", TextBoxDate.Text); try { con.Open(); adptr = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); adptr.Fill(ds); dt
manikumar_gutti
Posts
-
Problem in displaying data. -
problem in displaying the data in datagrid`Hi, I am mani. I have a problem in display the data in datagrid. What i did is I am creating a form and in this form i created a 6 textboxes and one search button. whenever the user enter a text in textbox i retrieve the data from the database and displayed in the datagrid. The problem is when the user again enter the text in text box the datagrid is filled with new data and last data will be lost. But i want that newly searching data should be displayed in datagrid including the last searching data. If anyone knows the way how it should be doing please rly me. and provide an example in maintaing a datatable session variable. regards, manikanta.
-
url problemThank you for the answer i asked before. it is great. i have the same problem with url. just look at the code below. // open a hypertext link with javascript: scheme to call display function document.write('[') // print transparent image (use any height and width) document.write('
') // close link tag document.write('](javascript:display('' + (red + green + blue) +''))') in href link why they didnt take the url. what is the meaning of that code "javascript:display(\' '+(red+green+blue)+'\')" why they take like that? can u expaline it clearly. regards Manikanta
-
initialize the variable with image taghi, I have a problem with this code. if you understand this please send me the explantion. I dont understand the variable intialization. could u please tell me what it means. var openImage = "
" function getPath(url) { lastSlash = url.lastIndexOf("/") return url.substring(0, lastSlash + 1) } regards manikanta
-
phone number validation in javascriptHi Thank you for your answer that i last time i asked. Now i want the phone number validation in javascript. How can we validate a phone number. if i give a invalid phone number it gives an error mesage. eg: 000000000
-
date validationHello This is manikumar. I am new to the web developement. How can we validate a date in javascript