Hey there,

Im doing for a typing platform project to test the typing speed of a user.

I have a SQL database (para1) which store a list of words. I use datalist and linqdatasource to display the text in a textbox (paraBox). What should i do to match the word that i typed in the textbox "typingBox" with the words in "paraBox" ?

My code are as below:

<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
    <asp:DataList ID="DataList1" runat="server" DataSourceID="LinqDataSource1">
        <ItemTemplate>
            <div class="paraBox">
                <asp:TextBox ID="paraBox" Text='<%# Eval("Para1") %>' runat="server" Overflow="auto" Height="80px" Width="800px"></asp:TextBox> 
            </div>                        
        </ItemTemplate>
    </asp:DataList>   

    <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="Test_WebRole.ParaDataDataContext" EntityTypeName="" Select="new (Para1)" TableName="Paras">
    </asp:LinqDataSource> 

    <br />
    <div class="textBox">
        <asp:TextBox ID="typingBox" runat="server" Height="40px" Width="400px"></asp:TextBox>       
    </div>


</asp:Content>

Thanks in advance

In this case you would have to loop throw the DataSource itens and test one by one, using simple complare(==), IndexOf(to match the begining) or regular expression(to do more sofisticated matches).

Another way is to query the database for matches using the equals or like operators.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.