.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Post New Web Links

Search for a string in my datasource dynamically

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net

I am displaying an Rssfeed on my page by using XmlDataSource and Datalist controls.

I want the user to be able to limit the information that is returned to my datalist.  To do this I have a textbox on the form that allows the user to enter their search criteria.

I need to be able to dynamically create a query string utilizing the information that the user entered in the textbox.  I am also using a drop down list and allowing the user to select whether they want to search in the title, description, or all parts of the xml file.

I am having trouble figuring out how to reference the data contained in my textbox in my query string.  Where the query string says 'asp', I want to replace 'asp' with the content from my sSearch variable.  Can anyone tell me how to reference my variable in the query string???

string sSearch = txtSearch.Text;
        string SQuery = "";

        if (DropDownList2.SelectedIndex == 0)
            SQuery = "[contains(title), 'asp')]";

View Complete Post

More Related Resource Links

ComboBox Display list does not update if a datasource is a boxed string

I have a combo box databound to a BindingSource bound to a List<Holder> it has Holder.Name as its display value. I also have a text box bound to Holder.Name but if I change the text in the text box it will not change what is displayed in the combo box. Changing selected items and changing back will show the updated text in the text box but will still have the old value displayed in the combo box. How do I make the item in the combo box update? namespace Sandbox_Form { public partial class Form1 : Form { public Form1() { InitializeComponent(); lstBroken = new List<Holder>(); lstBroken.Add(new Holder("test1")); lstBroken.Add(new Holder("test2")); bsBroken = new BindingSource(lstBroken, null); cmbBroken.DataSource = bsBroken; cmbBroken.DisplayMember = "Name"; txtBroken.DataBindings.Add("Text", bsBroken, "Name"); lstWorks = new List<string>(); lstWorks.Add("test3"); lstWorks.Add("test4"); bsWorks = new BindingSource(lstWorks, null); cmbWorks.DataSource = bsWorks; txtWorks.DataBindings.Add("Text", bsWorks, null); } } public class Holder { public Holder(string name) { Name = name; } public string Name { get; set; } } }

Writing connection string in web.config file by code or dynamically

I want to write connection string in web.config file of my application by code. If anyone know the way or code just help me..NET,C#,SQL SERVER

Weird Issue with the MOSS Search : FileExtension metadata object type instead of string

Hello, We 've got a strange issue with the search and especially with the FileExtension metadata. when we make a query on the search engine, we receive for the FileExtension metadata an unexcpected result. here is a printscreen showing the issue. http://cid-53eee937847a625e.photos.live.com/self.aspx/Public/Untitled.jpg as you can see the Type of the FileExtension is object and it should be string and I checked the type of the object and it's System.String[] the element at the index 0 contains the value! what's wrong ? thx in advance

How can I programatically set a connection string in a datasource

I am thinking of putting a drop down list to choose a couple of options.  Depending on what is selected I want to then specify a specific connection string.  I use the ConnectionString="<%$ ConnectionStrings:SomeConnectionString %>" format.  How can I handle this in the .aspx page?

setting datasource connection string globally

hi.... to all can anybody help me it urgent please.. hi i have 10 seperate crystal reports for an employee database.. it is working good.. now the main problem is i've shifted my database to another location.. now i want to change the datasource connection string for all the crystal reports.. it is very complicated.. instead of changing the connection string for each report can anybody tell me how to keep the connection string global. if i change the connection string in global then it should be applied to all the reports.. is there any solution..reply me fast..

dynamically add coulmn name in sql query for search


i want to add add coulmn name in sql query at run time and if any field is blank or null  than it should not goes with sql query for search ....

column name:




SqlCommand cmd = new SqlCommand("select * from hotelreg where '" + firstName.Text + "' and '" + lastName.Text + "', and '" + address.Text + "' like '%"+textbox1.Text+"%'", con);

plz reply me

SP Search from Windows 7 Start Menu: No reset of search string?


Try to enhance the search experience for our Windows 7 users. Have enabled the group policy setting User\Policy\Windows Components\Windows Explorer\Pin Libraries or Search connectors to the "search again links"and the Start menu and populated it with the value https://sharepoint.company.ch/SearchCenter/Seiten/results.aspx?k={searchTerms}&s=Alle%20Websites.

It works perfect when performed a Sharepoint search the first time. However, when searching a second time, the search string that should be provided by {SearchTerms} is not transferd correctly, and the search result (and the displayed search terms) are identical to the first search.

Any advice? Thank you in advance for any help!


Shared Datasource Connection String Keeps Getting Wiped Out


I originally reported this on the TechNet site, but one of the moderators asked me to post here. Here's the link to that thread: http://social.technet.microsoft.com/Forums/en-US/sqlreportingservices/thread/a4c54e10-3d59-4d30-8264-bfc250b4cfbe

I have a report that has a main report query based off an OLAP cube. It also uses a shared datasource for other queries. There are times when I make a seemingly innocuous change to the report, like adding a border to a table cell, and when I go to preview the change, the report comes back to tell me:

[rsInvalidReportDefinition] The report definition is not valid. Details: The report definition element 'ConnectionProperties' is empty at line 13, position 9. It is missing a mandatory child element of type 'DataProvider'.
Build complete -- 1 errors, 0 warnings

I then have to go into the Datasource Properties window, just opening it and then hitting "OK" to close it again, to reinstate the connection string (even though it shows properly when I open the dialog box). The kicker is that it seems totally random. Sometimes the small change will require this action and other times it doesn't. Version information can be found on the TechNet posti

Using connection string instead of datasource in report server 2005



I am using a datasource in the report server where all the reports use that shared datasource while calling the reports from asp.net pages.

Now, as asp.net pages uses the connection string for the databases which is assigned in the web.config file, i want the reports also use the same connection string because you don't need to change on both places( web.config and report server datasource).

Any idea plz

i am working on VS2005 and ssrs 2005


Do not feel regret.... just try to improve..... its far better

Dynamically format string value in gridview


I have a gridview that is built  using a objectdatasource and set to autogenerate the columns based on that source, on some other pages i have a gridview that is built within the page with template fields and so on..

in that gridview i have a field that displays the time value like so

<asp:Label ID="lblstartDate" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"startDate", "{0:t}") %>'

Search string (in txt file) --> Get the string between quotes which comes after it --> Add item in l


Hello :)

I've mentioned my complete objective in the title.

I already know how to find a string, and add a item in listbox.
But so far I kept failing at retreiving the string between the quotes

My txt file looks like this:

List of delicious fruits ( Index 1 "Apple") ( Index 2 "Cherry") ( Index 3 "Banana") (...) (...)

The listbox has to view this :

Apple Cherry Banana

This is how far I got.

public void fruitFinderBlock()
 StreamReader reader = new StreamReader(@"C:\TEST.txt");
 string content = reader.ReadToEnd();
 while (content != null) // while not at end of file
 string Find = "Index";
 if (content == Find)
 string fruitname;

 // TODO assign fruitname to the string between the quotes 

search a string in SQL Server 2005.



I have SQL Server 2005 installed. I want to search a string (phone number) in my DB. I don't know the string is stored in which DB,which table, or even which column. All I know is the string. I don't want to export the DB to excell. It seems that 2005 can't generate a script with script data. What shall I do? Could you pleasae give me a T-SQL or something so that I can run it to search the string?

Best Regards,


MS SQL Server: Search All Tables, Columns & Rows For Data or Keyword Query

If you need to search your entire database for specific data, this query will come in handy.

So when a client needs a custom report or some sort of custom development using Great Plains, most of the time I will have to track down the data in the system by running this query and find the table(s) it is in.

Hide a repeater in ASP.NET C# if the DataSource contains no items?

I have an ASP.NET page that uses a repeater nested within another repeater to generate a listing of data. It's to the effect of the following:
In the (C#) code-behind I'm basically using LINQ to pull a listing of information from an XML document and bind that information to the first repeater.

Searching for the answer to this, it seems the method is to determine whether the data for the nested repeater is empty. If it is, then you set the visibility of the repeater to false.

How to Encrypt Query String Parameters in ASP.NET

Encrypt Query String Parameters in ASP.NET.u can send secure data one page another page u can also use query string to encrypt

SharePoint Gets Search Analytics

Microsoft's SharePoint Portal Server 2003 was sold into a large number of organizations based solely on the strength of the search tool. Organizations hungered for a way to find the data they had generated.

Using SharePoint Search feature in ASP.Net Application

Integrating ASP.Net application in to MOSS 2007 to utilize SharePoint Enterprise Search Feature can be done by using Business Data Search.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend