Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7434463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:50:32+00:00 2026-05-29T09:50:32+00:00

I have table in my database which has fields of ID,NAME,CONTEXT. I am showing

  • 0

I have table in my database which has fields of ID,NAME,CONTEXT. I am showing search result in datagrid. Now I tried to do this

        <WpfToolkit:DataGrid.RowDetailsTemplate>
            <DataTemplate>
                **<StackPanel Orientation="Horizontal" Margin="5">
                        <StackPanel Orientation="Vertical" Margin="5">
                        <TextBlock Foreground="CadetBlue" FontSize="13" 
                            Width="Auto" TextWrapping="Wrap"
                            Text="{Binding Path=Context}"/>
                    </StackPanel>**
                </StackPanel>
            </DataTemplate>
        </WpfToolkit:DataGrid.RowDetailsTemplate>

It is giving whole text which is not what I want. If you give me some directions how to do this, may be some code. It will be appreciated. I want to show only that part of text which is selected by this line of code.

 private void Find_Click(object sender, RoutedEventArgs e)
        {


            DataSet ds = new DataSet();
             cmdSel = new SqlCommand();
             cmdSel.Connection = MainWindow.conn;

               cmdSel.CommandText = "select id,Name,Context from document where Contains([Context],'FormsOf (INFLECTIONAL, \"" + TextBoxSearch.Text + "\")')";

                     da = new SqlDataAdapter(cmdSel);
             da.Fill(ds, "MainSearchBinding");
             resWin.DataGrid1.DataContext = ds;

                   }

For example you are searching for “audio” and it is showing 10 words before + “audio” + 10 word after audio. Thank in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T09:50:33+00:00Added an answer on May 29, 2026 at 9:50 am

    I add one more column “Intro” to my table.

     <WpfToolkit:DataGrid.RowDetailsTemplate>
    
                    <DataTemplate>
                    <StackPanel Orientation="Horizontal" Margin="5">
                            <StackPanel Orientation="Vertical" Margin="5" >
                                <TextBlock Foreground="CadetBlue" FontSize="13" 
                                Width="Auto" TextWrapping="Wrap" 
                                Text="{Binding Path=Intro}"/>
    
                        </StackPanel>
                    </StackPanel>
                </DataTemplate>
            </WpfToolkit:DataGrid.RowDetailsTemplate>
    

    And wrote this code for mouse click.

    private void OnMouseClick(object sender, MouseButtonEventArgs e)
            {
    
                IList rows = DataGrid1.SelectedItems;
                DataRowView row = (DataRowView)DataGrid1.SelectedItems[0];
                int a = (int)row["ID"];
                string t = (string)row["Context"]; //getting all text from Context
                string srch1 = UCSearch.srch; // search box text
    
                if (t.IndexOf(srch1) != -1)
                {
                    string retString = t.Substring(t.IndexOf(srch1), 100); //cutting from occured text and more 100 symbols
    
                    row["Intro"] = retString; // setting to Intro Column 
    
                }
    
    
            }
    

    I hope some one may need it. Thank you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database structure that has a Person table which contains fields such
I have a table (session) in a database which has almost 72,000 rows. I
I have a table in SQLite database of Android which has a column RANK
I have a table which has essentially boolean values in a legacy database. The
I have a database table A which stores records, A has a primary key
We have a Oracle 9i database and OrderDetails table which has a column to
Say I have a database which has the following layout: Fields: |Business_Name| |Business_ID| Data
I have a table in my database which has duplicate records that I want
I have an unusual SQL table (not mine) which has the following fields (among
I have a table in database that has 2 columns Name | Age, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.