Click here to Skip to main content
15,913,263 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: dropdown Pin
N a v a n e e t h29-Jan-09 19:21
N a v a n e e t h29-Jan-09 19:21 
GeneralRe: dropdown Pin
gvpr29-Jan-09 19:26
gvpr29-Jan-09 19:26 
GeneralRe: dropdown Pin
N a v a n e e t h29-Jan-09 19:30
N a v a n e e t h29-Jan-09 19:30 
GeneralRe: dropdown Pin
Christian Graus29-Jan-09 20:14
protectorChristian Graus29-Jan-09 20:14 
GeneralRe: dropdown Pin
Ashutosh Phoujdar29-Jan-09 22:09
Ashutosh Phoujdar29-Jan-09 22:09 
QuestionRegistry access Pin
siva45529-Jan-09 19:02
siva45529-Jan-09 19:02 
AnswerRe: Registry access Pin
N a v a n e e t h29-Jan-09 19:20
N a v a n e e t h29-Jan-09 19:20 
GeneralRe: Registry access Pin
siva45529-Jan-09 19:40
siva45529-Jan-09 19:40 
GeneralRe: Registry access Pin
N a v a n e e t h29-Jan-09 21:09
N a v a n e e t h29-Jan-09 21:09 
GeneralRe: Registry access Pin
siva45529-Jan-09 21:30
siva45529-Jan-09 21:30 
AnswerRe: Registry access Pin
Ashutosh Phoujdar29-Jan-09 22:14
Ashutosh Phoujdar29-Jan-09 22:14 
GeneralRe: Registry access [modified] Pin
siva45529-Jan-09 22:24
siva45529-Jan-09 22:24 
GeneralRe: Registry access Pin
Ashutosh Phoujdar29-Jan-09 23:13
Ashutosh Phoujdar29-Jan-09 23:13 
GeneralRe: Registry access Pin
siva45529-Jan-09 23:55
siva45529-Jan-09 23:55 
QuestionHow to access a control of a Master Page? Pin
zinzil29-Jan-09 18:22
zinzil29-Jan-09 18:22 
AnswerRe: How to access a control of a Master Page? Pin
Spunky Coder29-Jan-09 18:56
Spunky Coder29-Jan-09 18:56 
QuestionCreating a Search Control Pin
scotchy2hotty2k229-Jan-09 18:19
scotchy2hotty2k229-Jan-09 18:19 
Hi all I want to create a very generic search control which i can use it on any page.so as to search the data from the table provided by user,list of columns and the sql will be dynamically created depending on textbox id and there respective values.
Please Suggest how do i create a server control so that i can use it on any page which will be either return dynamic sql or datasource for binding with gridview.





protected void Button1_Click(object sender, EventArgs e)
{
string conn=server=localhost;database=MyData;uid=sa;password=password";
SqlConnection sconn = new SqlConnection();
sconn.ConnectionString = conn;
ArrayList ar = new ArrayList();
ArrayList ar1 = new ArrayList();
foreach (Control c in Panel1.Controls)
{

Type t = c.GetType();
string id;
string value;
string name = t.Name;
TextBox t1 = null;
if (name.Equals("TextBox"))
{
id = c.ClientID;
ar.Add(id);
t1 = (TextBox)c;
if (t1.Text.Length>0)
{
value = t1.Text;
}
else
{
value = "%";
}
ar1.Add(value);

}
}


bool lbHasWhere = false;
StringBuilder loBuffer = new StringBuilder();

loBuffer.Append("Select '"+columns+"' From '" + tablename+ "'");



for (int k = 0; k < ar.Count; k++)
{

if (lbHasWhere)
loBuffer.Append(" And ");
else
{
loBuffer.Append(" Where ");
lbHasWhere = true;
}
loBuffer.Append("" + ar[k] + " like '" + ar1[k] + "'");
}


SqlCommand scomm = new SqlCommand();
scomm.CommandText = loBuffer.ToString();
scomm.Connection = sconn;
sconn.Open();

SqlDataReader sdr = scomm.ExecuteReader();
GridView1.DataSource = sdr;
GridView1.DataBind();
sconn.Close();
}
}
QuestionClick Once - Publish.html - not recognizing framework 2.2.30729 Pin
N.Surendra Prasad29-Jan-09 17:58
N.Surendra Prasad29-Jan-09 17:58 
QuestionHiding WebForm in ASP.NET Pin
siddisagar29-Jan-09 17:05
siddisagar29-Jan-09 17:05 
AnswerRe: Hiding WebForm in ASP.NET Pin
N a v a n e e t h29-Jan-09 17:42
N a v a n e e t h29-Jan-09 17:42 
QuestionHow to make a post to page with href url Pin
papy-boom29-Jan-09 13:22
papy-boom29-Jan-09 13:22 
AnswerRe: How to make a post to page with href url Pin
Tad McClellan29-Jan-09 17:12
professionalTad McClellan29-Jan-09 17:12 
QuestionApplication_End () problem Pin
sana1729-Jan-09 9:53
sana1729-Jan-09 9:53 
AnswerRe: Application_End () problem Pin
Steven James Gray29-Jan-09 10:37
Steven James Gray29-Jan-09 10:37 
AnswerRe: Application_End () problem Pin
Tad McClellan29-Jan-09 11:01
professionalTad McClellan29-Jan-09 11:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.