Hi:
I would like to have user enter a value in the text box and have a record shown in the FormView. I know how to do it with the dropdown list showing the values but the list would be too long to display. I onder to find a record I would need to have user type it in. The field to seach on is a unique (key) field.
CAn you suggest a method?
Thanks.
It is exactly the same, except that you will need a submit button
<asp:TextBox id="txt1" runat="server" />
<asp:Button OnClick="submit" Text="Submit" runat="server" />
and on postback
Sub submit(sender As Object, e As EventArgs)
re-bind using this query "SELECT * FROM SomeTable Where ID = " & txt1.Text
End Sub
Is this what u mean?
I think he just want to know the TextChange event on TextBox.you can use this to show you record in FormView.but this textchange event i think prefer for Asp.net Ajax enabled website.i also think there is one event name like textbox lose focus,you can found this.
![]()
you mean onBlur (maybe OnServerChange?)
Anyway... I'm pissed of cause I had 199 points and now I have only 195 miserable points... somethign stinks in here!!!
kidding,
Mauro
Hi:
Thanks for your advise. I tried few things as follows:
1) I created a textbox txt1 and a button
2) I placed controls in the Ajax update panel
3) I added formview based on the query and added a parameter as follow: (permit# is my search field and my key)
<asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString %>"
SelectCommand="SELECT [PermitNo], [TaskId], [ProjectManagerId], [OnSiteFirstName] FROM [Permits] where PermitNo = @.PermitNo">
<SelectParameters>
<asp:ControlParameterControlID="txt1"Name="PermitNo"PropertyName="Text"/>
</SelectParameters>
</asp:SqlDataSource>
So, when I type Permit number in my box it runs a query and show my record in formview.
This works perfectly. But I need to write something so it will test for "not found" so I could display message "Record not found". Do you have any ideas how I can do it? I use C# but possibly I can do it with ASP??
I would appreciate your assistance.
Hi:
Thanks for your advise. I tried few things as follows:
1) I created a textbox txt1 and a button
2) I placed controls in the Ajax update panel
3) I added formview based on the query and added a parameter as follow: (permit# is my search field and my key)
<asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString %>"
SelectCommand="SELECT [PermitNo], [TaskId], [ProjectManagerId], [OnSiteFirstName] FROM [Permits] where PermitNo = @.PermitNo">
<SelectParameters>
<asp:ControlParameterControlID="txt1"Name="PermitNo"PropertyName="Text"/>
</SelectParameters>
</asp:SqlDataSource>
So, when I type Permit number in my box it runs a query and show my record in formview.
This works perfectly. But I need to write something so it will test for "not found" so I could display message "Record not found". Do you have any ideas how I can do it? I use C# but possibly I can do it with ASP??
I would appreciate your assistance.
FormView lets u define a template for "no data"
<emptydatatemplate>
No records available.
</emptydatatemplate>
More info at:http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.formview.emptydatatemplate(VS.80).aspx
Regards,
Mauro
Yes, thank so much for your help. I got this working!!!!
It is Friday afternoon - I will check it on Monday - but I am sure it will work! Thanks for all your assistance .
0 comments:
Post a Comment