asp:Textbox within asp:table
I am trying to pass a SqlParameter
to a SqlDataSource
.
The SqlDataSource
has a condition ...Where A.PERS_LNAME = @PERS_LNAME
Now coming to configuring SqlDataSource
, I click on 'Configure Data Source' and reach till the 'Define Parameters' step.
I selected 'Parameter Source' = Control, but I don't see the <asp:Table>'s ID's
at all!
Only the GridView
's id
is shown in the dropdown.
In short, I don't see the <asp:tablecell>
's id
at all
This is how my <asp:Table>
is defined.
<asp:Table runat="server">
<asp:TableRow runat="server">
<asp:TableCell runat="server">Lastname:</asp:TableCell><asp:TableCell runat="server"><asp:Text开发者_如何学JAVABox ID="sqlParameterLastname" runat="server"></asp:TextBox></asp:TableCell>
<asp:TableCell runat="server">Firstname:</asp:TableCell><asp:TableCell runat="server"><asp:TextBox ID="sqlParameterFirstname" runat="server"></asp:TextBox></asp:TableCell>
</asp:TableRow>
</asp:Table>
Additional Info:
The following two scenarios work, but the third one doesn't work. Please note that the difference between 2 & 3 is that I have introduced an extra column with a <td>LastName</td>
<asp:TextBox ID="sqlParameterLastname" runat="server">
<table><tr><td><asp:TextBox ID="sqlParameterLastname" runat="server"></asp:TextBox></td></tr></table>
<table><tr><td>LastName</td><td><asp:TextBox ID="sqlParameterLastname" runat="server"></asp:TextBox></td></tr></table>
Can you help me where I am going wrong? Or is such embedding of asp controls not permitted?
You can indeed embed them in the table like you're attempting, however I've never tried to assign a ControlParameter like that from the Wizard.
Additionally, I think you have two different questions here.
However, I also feel that you're trying to do what is shown on this page. Does this link offer any more insight for you? https://web.archive.org/web/20211020150717/https://www.4guysfromrolla.com/articles/030106-1.aspx
New idea, concept. Use divs to arrange the layout. Yeah, you're doing a table based layout, but with divs it will function differently to the compiler. If you need help with this, let me know. Here's a sample page that google turned up http://bonrouge.com/~div-table
This won't work because the controls are child controls of your table control. The same problem exists if you put controls in GridView's, ListView's, Repeaters, etc.. if the grid has to generate the controls dynamimcally (which it's doing here) then they aren't available at design time.
If you have a static table, you're better off just using html table elements anyways.
精彩评论