<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>SQL Server, SQL Server Express, and SqlDataSource Control</title><link>http://forums.asp.net/54.aspx</link><description>All about SQL Server, SQL Server Express, MSDE, and the SqlDataSource control.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Retrieve value to a textbox from SqlDataSource in UpdatePanel</title><link>http://forums.asp.net/thread/3282832.aspx</link><pubDate>Thu, 09 Jul 2009 06:50:27 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3282832</guid><dc:creator>Jian Kang - MSFT</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3282832.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=54&amp;PostID=3282832</wfw:commentRss><description>&lt;p&gt;Hi Jedicillo,&lt;/p&gt;
&lt;p&gt;From your description, I think you would like something like follows:&lt;/p&gt;
&lt;p&gt;WebForm1.aspx&lt;/p&gt;&lt;pre class="xhtml" name="code"&gt;&amp;lt;form id=&amp;quot;form1&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;
    &amp;lt;asp:ScriptManager ID=&amp;quot;ScriptManager1&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;
    &amp;lt;/asp:ScriptManager&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;asp:UpdatePanel ID=&amp;quot;UpdatePanel1&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;
        &amp;lt;ContentTemplate&amp;gt;
            --Inside the UpdatePanel--&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
            CategoryID
        &amp;lt;asp:TextBox ID=&amp;quot;TextBox1&amp;quot; runat=&amp;quot;server&amp;quot; AutoPostBack=&amp;quot;True&amp;quot;&amp;gt;&amp;lt;/asp:TextBox&amp;gt;
            (Press Enter to submit)&amp;lt;br /&amp;gt;
            CategoryName
        &amp;lt;asp:TextBox ID=&amp;quot;TextBox2&amp;quot; runat=&amp;quot;server&amp;quot; ReadOnly=&amp;quot;True&amp;quot;&amp;gt;&amp;lt;/asp:TextBox&amp;gt;
        &amp;lt;asp:SqlDataSource ID=&amp;quot;SqlDataSource1&amp;quot; runat=&amp;quot;server&amp;quot; 
            ConnectionString=&amp;quot;&amp;lt;%$ ConnectionStrings:northwindConnectionString %&amp;gt;&amp;quot; 
            SelectCommand=&amp;quot;SELECT [CategoryName] FROM [Categories] WHERE ([CategoryID] = @CategoryID)&amp;quot;&amp;gt;
            &amp;lt;SelectParameters&amp;gt;
                &amp;lt;asp:ControlParameter ControlID=&amp;quot;TextBox1&amp;quot; Name=&amp;quot;CategoryID&amp;quot; 
                    PropertyName=&amp;quot;Text&amp;quot; Type=&amp;quot;Int32&amp;quot; /&amp;gt;
            &amp;lt;/SelectParameters&amp;gt;
        &amp;lt;/asp:SqlDataSource&amp;gt;
        &amp;lt;br /&amp;gt;

        &amp;lt;/ContentTemplate&amp;gt;
        &amp;lt;/asp:UpdatePanel&amp;gt;
        
    &amp;lt;br /&amp;gt;&amp;lt;hr /&amp;gt;&amp;lt;br /&amp;gt;

    --Outside the UpdatePanel--&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
    &amp;lt;%=DateTime.Now%&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/form&amp;gt;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;WebForm1.aspx.vb&lt;/p&gt;&lt;pre class="vb.net" name="code"&gt;Protected Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As EventArgs) Handles TextBox1.TextChanged

    Dim dv As DataView = DirectCast(Me.SqlDataSource1.Select(DataSourceSelectArguments.Empty), DataView)

    If dv.Table.Rows.Count &amp;gt; 0 Then
        TextBox2.Text = dv.Table.Rows(0)(0).ToString()
    Else
        TextBox2.Text = &amp;quot;There is no such a record.&amp;quot;
    End If

End Sub&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;The TextChanged event is raised when the content of the text box changes between posts to the server. &lt;/p&gt;
&lt;p&gt;Related documents:&lt;/p&gt;
&lt;p&gt;TextBox.TextChanged Event&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.textchanged.aspx"&gt;http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.textchanged.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;SqlDataSource.Select Method&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sqldatasource.select.aspx"&gt;http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sqldatasource.select.aspx&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Re: Retrieve value to a textbox from SqlDataSource in UpdatePanel</title><link>http://forums.asp.net/thread/3274925.aspx</link><pubDate>Sat, 04 Jul 2009 19:27:09 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274925</guid><dc:creator>Jedicillo</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274925.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=54&amp;PostID=3274925</wfw:commentRss><description>&lt;p&gt;I use the updatepanel to make a partial update and show the descr in textbox2, actually i have AutoPostBack=&amp;quot;True&amp;quot;&amp;nbsp;. How can it be done whitout updatepanel? Can&amp;#39;t use Page_Load() because there will be others inputs in the same page.&lt;/p&gt;&lt;p&gt;Also to show the data in textbox2 i have to make a select to my database at TextChanged. But i hadn&amp;#39;t found a way to make this without ado, &amp;nbsp;considering that the query is via stored procedure with parameters. Is this posible with sqldatasorce?&lt;/p&gt;</description></item><item><title>Re: Retrieve value to a textbox from SqlDataSource in UpdatePanel</title><link>http://forums.asp.net/thread/3274167.aspx</link><pubDate>Sat, 04 Jul 2009 03:17:15 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274167</guid><dc:creator>RickNZ</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274167.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=54&amp;PostID=3274167</wfw:commentRss><description>&lt;p&gt;You could use Ajax to do what you&amp;#39;re asking without an UpdatePanel.&amp;nbsp; With an UpdatePanel, you should be able to set AutoPostBack=&amp;quot;true&amp;quot; on the TextBox control, and then process the postback either with a TextChanged event or in Page_Load(), to set the value of the other TextBox.&lt;/p&gt;&lt;p&gt;If I haven&amp;#39;t decoded your problem description correctly, it might help if you could post your code.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Retrieve value to a textbox from SqlDataSource in UpdatePanel</title><link>http://forums.asp.net/thread/3273979.aspx</link><pubDate>Fri, 03 Jul 2009 20:20:14 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3273979</guid><dc:creator>Jedicillo</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3273979.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=54&amp;PostID=3273979</wfw:commentRss><description>&lt;p&gt;HI all,&lt;/p&gt;&lt;p&gt;I&amp;#39;ve been on this for 3 days now.&lt;/p&gt;&lt;p&gt;I have 2 textbox and 1 sqldatasource in 1 updatepanel.&lt;/p&gt;&lt;p&gt;The idea is: I type some cod in textbox1, when textbox1 lose focus, textbox2 is filled with the description of the cod in textbox1. All this in an updatepanel, because i have to put some other data in the same page.&lt;/p&gt;&lt;p&gt;I have tried with the event TextBox1_TextChanged, but from the sentence Dim dv = CType(SacaNombre.Select(DataSourceSelectArguments.Empty), DataView), it just don&amp;#39;t work. Also have read some stuff about webservices and webmethod, but since i am new in this, it seems a little complicated.&lt;/p&gt;&lt;p&gt;What can i do? Which way can i follow to accomplish this?&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;thanks.&lt;/p&gt;</description></item></channel></rss>