?
Solved

<asp:formparameter> not working

Posted on 2008-10-20
1
Medium Priority
?
561 Views
Last Modified: 2013-11-26
Hello Experts,
i have a textbox and a button in a page called ask.aspx. like below
 <asp:TextBox ID="tbempname" runat="server"></asp:TextBox>
    <asp:Button ID="btnFindEmp" runat="server" Text="Find Emp" PostBackUrl="~/textform.aspx" />
   
and in the textform.aspx page i have gridview showing the employee details
<asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1" AllowPaging="True" AutoGenerateColumns="False" BackColor="LightGoldenrodYellow" BorderColor="Tan" BorderWidth="1px" CellPadding="2" DataKeyNames="EmployeeID" ForeColor="Black" GridLines="None">
        <FooterStyle BackColor="Tan" />
        <Columns>
            <asp:BoundField DataField="EmployeeID" HeaderText="Emp Number" HtmlEncode="False"
                InsertVisible="False" ReadOnly="True" SortExpression="EmployeeID" />
            <asp:BoundField DataField="FirstName" HeaderText="First Name" SortExpression="FirstName" />
            <asp:BoundField DataField="LastName" HeaderText="Last Name" SortExpression="LastName" />
            <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
        </Columns>
        <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
        <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
        <HeaderStyle BackColor="Tan" Font-Bold="True" />
        <AlternatingRowStyle BackColor="PaleGoldenrod" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:northwndConnectionString %>"
        SelectCommand="SELECT [EmployeeID], [FirstName], [LastName], [Title] FROM [Employees] WHERE ([LastName] = @LastName)">
        <SelectParameters>
            <asp:FormParameter FormField="tbempname" Name="LastName" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>

so basically when i type a emp lastname in the ask.aspx, its should dispay the results in the girdview in the textform.aspx.
but IT DOES NOT DISPLAY THE GRID AT ALL. just displays a blank page.
any idea or suggestions are highly appreciated.
Thanks
0
Comment
Question by:niceoneishere
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 26

Accepted Solution

by:
Anurag Thakur earned 1500 total points
ID: 22763997
your text box is on one page and the form parameter is on another page and you want to access the textbox text in another page
cannot be done this way
you need to pass the text box value to the second page and then only the value will be assigned to the formparameter

simple sample of same page formparameter
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.formparameter.aspx
0

Featured Post

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question