update parameter question in detailView?

Hi,

I have this detailview and i am using a dropdown in the editform.
I also used sqldatasource to update the record by passing the parameter.
Without the dropdown in the editform (all regular textboxes), it gets update fine.

But when I insert the dropdown in the edittemplate, it doesn't get update and no error pops up.
I don't know how to debug this since I don't get any errors when I run it.

As an example, say I have this address table(ID,Name,Address,Type)

I thought I can use fixed parameter and controlparameter.
But it doesn't get updated.

How can I debug this??
Should I stay away from the sqldatasource and use the stored proc or code in code behind page??

<asp:sqldatasource id=sqldatasource1
selectcommand="select id,name,address,type from address where (id=@id)"
updatecommand = "update address set name=@name,address=@address,type=@type where (id=@id)">
<selectParamenters>
<asp:querystringparameters name=id querystringfield=id type=int/>
</selectparamenters>
<updateparameters>
<asp:parameter>...
<asp:controlparameter>...
</updateparameters>
 
 
I thought I can use fixed parameter and controlparameter.
But it doesn't get updated.

Open in new window

dkim18Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CmdoProg2Commented:
try this ....
     <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataKeyNames="id"
        DataSourceID="SqlDataSource1" Height="50px" Width="125px">
        <Fields>
          <asp:BoundField DataField="name" HeaderText="name" SortExpression="name" />
          <asp:BoundField DataField="address" HeaderText="address" SortExpression="address" />
          <asp:BoundField DataField="type" HeaderText="type" SortExpression="type" />
          <asp:CommandField ShowEditButton="True" />
        </Fields>
      </asp:DetailsView>
      <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="MyConnString"
        ProviderName="System.Data.SqlClient" SelectCommand="SELECT [id], [name], [address], [type] FROM [testers] WHERE ([id] = @id)"
        UpdateCommand="UPDATE testers SET name = @name, address = @address, type = @type WHERE (id = @id)">
        <UpdateParameters>
          <asp:Parameter Name="name" />
          <asp:Parameter Name="address" />
          <asp:Parameter Name="type" />
          <asp:Parameter Name="id" />
        </UpdateParameters>
        <SelectParameters>
          <asp:QueryStringParameter Name="id" QueryStringField="id" Type="Int32" />
        </SelectParameters>
      </asp:SqlDataSource>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dkim18Author Commented:
It works fine with default editform like your example.

When I change it to templatefield, it is not updating correctly.

I had three boundfields and one templatefield with dropdownlist.
Nothing happens.

 
0
CmdoProg2Commented:
Could you send me the snippet of the detail view?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.