views:

23

answers:

2

Hi All,

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:TextBox 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>

  1. <asp:TextBox ID="sqlParameterLastname" runat="server">

  2. <table><tr><td><asp:TextBox ID="sqlParameterLastname" runat="server"></asp:TextBox></td></tr></table>

  3. <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? Thanks!

+1  A: 

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? http://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

drachenstern
No...manually adding <SelectParameters> did not work too.. what's intriguing me is there isn't any Runtime exception or build error..
There must be `some` error if it's giving you fits. Either that or you've keyed something in wrong. If it won't just stop you from launching the website for testing, then you've got to get an exception if it doesn't work. How are you triggering it to goto the database?
drachenstern
What if you just put the code in a `<table><tr><td>` structure?
drachenstern
inserting the code within <table><tr></td> works.
Then I would just use that instead. There's no benefit programmatically to how you're using the `<asp:Table>` tags, so omit them. It's probably causing an ID issue because it's so deeply nested.
drachenstern
Addendum to my previous comment: I just noticed your updated question after I posted that one. It's not a nested ID issue. I don't know what's causing that. Ergo I revised my answer below the HR
drachenstern
The idea about DIVs was what I was working on.. will let you know if that works or not..
A: 

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.

Mystere Man
Yeah.. but it's not working when I am using the `<asp:Textbox>` within 'pure' html (as in option 3 )