Click here to Skip to main content
15,917,875 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: HyperLink inside of CheckBox Pin
msqar26-Mar-11 22:11
msqar26-Mar-11 22:11 
QuestionDeny access to an aspx menu in webconfig, Role Based Authorization Pin
De_Novice26-Mar-11 10:19
De_Novice26-Mar-11 10:19 
AnswerRe: Deny access to an aspx menu in webconfig, Role Based Authorization Pin
Sandeep Mewara26-Mar-11 21:39
mveSandeep Mewara26-Mar-11 21:39 
QuestionHow to make the content Fixed Pin
the exile26-Mar-11 5:03
the exile26-Mar-11 5:03 
AnswerRe: How to make the content Fixed Pin
Ravi Sant26-Mar-11 6:45
Ravi Sant26-Mar-11 6:45 
GeneralRe: How to make the content Fixed Pin
the exile26-Mar-11 7:00
the exile26-Mar-11 7:00 
AnswerRe: How to make the content Fixed Pin
RaviRanjanKr26-Mar-11 7:16
professionalRaviRanjanKr26-Mar-11 7:16 
GeneralRe: How to make the content Fixed Pin
the exile26-Mar-11 22:26
the exile26-Mar-11 22:26 
GeneralRe: How to make the content Fixed [modified] Pin
msqar27-Mar-11 13:04
msqar27-Mar-11 13:04 
GeneralRe: How to make the content Fixed Pin
the exile27-Mar-11 22:28
the exile27-Mar-11 22:28 
GeneralRe: How to make the content Fixed Pin
msqar28-Mar-11 1:16
msqar28-Mar-11 1:16 
AnswerRe: How to make the content Fixed Pin
Dalek Dave26-Mar-11 7:21
professionalDalek Dave26-Mar-11 7:21 
GeneralRe: How to make the content Fixed Pin
the exile26-Mar-11 22:31
the exile26-Mar-11 22:31 
Questionnand_bca@rediffmail.com Pin
Nand Kishor Chaudhary26-Mar-11 3:43
Nand Kishor Chaudhary26-Mar-11 3:43 
AnswerRe: change your subject Pin
Ravi Sant26-Mar-11 6:36
Ravi Sant26-Mar-11 6:36 
QuestionProblem updating DetailsView when added DropDownList Pin
kbalias24-Mar-11 23:39
kbalias24-Mar-11 23:39 
Hi
I am struggling with updating data from a web page. On the page I have a DetailsView control which is bound to a table in the SQL Server database. I have enabled Editing.

One of the fields in the table is a foreign key to a lookup table (for the Referring Hospital) in the database. I would like to have a DropdownList in the DetailsView so that the user can choose the item.


I have changed the field to a TemplateField and while the field (“HospID”) is still a TextBox the update to database works. For example when I change the LastName and click ‘Update’, the update reflects in the database.

Here is the markup:

<asp:TemplateField HeaderText="HospID" SortExpression="HospID">
    <EditItemTemplate>
        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("HospID") %>'></asp:TextBox>
    </EditItemTemplate>
    <InsertItemTemplate>
        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("HospID") %>'></asp:TextBox>
    </InsertItemTemplate>
    <ItemTemplate>
        <asp:Label ID="Label1" runat="server" Text='<%# Bind("HospID") %>'></asp:Label>
    </ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="LastName" HeaderText="LastName" 
    SortExpression="LastName" />


However when I replace the TextBox in the EditTemplate with a DropdownList and try to update, the changes do not reflect in the database. Even if I have just changed the LastName.

The markup for the DropdownList is as follows:

<asp:TemplateField HeaderText="HospID" SortExpression="HospID">
    <EditItemTemplate>
        <asp:DropDownList ID="DropDownList1" runat="server" 
                DataSourceID="SqlDataSource_RefHosp" DataTextField="HospShort" 
                DataValueField="HospID">
            </asp:DropDownList>                
    </EditItemTemplate>
    <InsertItemTemplate>
        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("HospID") %>'></asp:TextBox>
    </InsertItemTemplate>
    <ItemTemplate>
        <asp:Label ID="Label1" runat="server" Text='<%# Bind("HospID") %>'></asp:Label>
    </ItemTemplate>
</asp:TemplateField>



Even if I just use a basic DropdownList with no databinding the update does not work.

<asp:DropDownList ID="DropDownList_RefHosp" runat="server" 
    DataTextField="HospShort" DataValueField="HospID">
</asp:DropDownList>



I am stumped here so if anybody can give me some pointers it will be appreciated.

Regards.

Kobus
AnswerRe: Problem updating DetailsView when added DropDownList Pin
Cnu5555526-Mar-11 2:15
Cnu5555526-Mar-11 2:15 
Questionhow to copy row from one gridview to another,each time a new row is added........ Pin
Seema Rayat24-Mar-11 22:02
Seema Rayat24-Mar-11 22:02 
AnswerRe: how to copy row from one gridview to another,each time a new row is added........ Pin
Not Active25-Mar-11 1:23
mentorNot Active25-Mar-11 1:23 
GeneralRe: how to copy row from one radgrid to another,each time a new row is added........ Pin
Seema Rayat25-Mar-11 1:30
Seema Rayat25-Mar-11 1:30 
GeneralRe: how to copy row from one radgrid to another,each time a new row is added........ Pin
Not Active25-Mar-11 2:22
mentorNot Active25-Mar-11 2:22 
QuestionHow can i input "&" in the html code? Pin
buffering8324-Mar-11 15:13
buffering8324-Mar-11 15:13 
AnswerRe: How can i input "&" in the html code? Pin
GlobX24-Mar-11 15:52
GlobX24-Mar-11 15:52 
GeneralRe: How can i input "&" in the html code? Pin
Pravin Patil, Mumbai25-Mar-11 2:04
Pravin Patil, Mumbai25-Mar-11 2:04 
AnswerRe: How can i input "&" in the html code? Pin
Dalek Dave26-Mar-11 3:39
professionalDalek Dave26-Mar-11 3:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.