Click here to Skip to main content
15,911,891 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionconfirmSave alert box,cancel button functionality not working Pin
Member 447022318-May-10 21:19
Member 447022318-May-10 21:19 
AnswerRe: confirmSave alert box,cancel button functionality not working Pin
banker_kiran18-May-10 23:42
banker_kiran18-May-10 23:42 
AnswerRe: confirmSave alert box,cancel button functionality not working Pin
Arindam Tewary18-May-10 23:43
professionalArindam Tewary18-May-10 23:43 
QuestionUpdate a Database Using Dropdownlist in ASP VB.Net Pin
grafiksinc18-May-10 21:06
grafiksinc18-May-10 21:06 
GeneralRe: Update a Database Using Dropdownlist in ASP VB.Net Pin
Dinesh Mani18-May-10 21:31
Dinesh Mani18-May-10 21:31 
GeneralRe: Update a Database Using Dropdownlist in ASP VB.Net Pin
grafiksinc19-May-10 12:33
grafiksinc19-May-10 12:33 
AnswerRe: Update a Database Using Dropdownlist in ASP VB.Net Pin
Dinesh Mani19-May-10 21:16
Dinesh Mani19-May-10 21:16 
AnswerRe: Update a Database Using Dropdownlist in ASP VB.Net Pin
grafiksinc19-May-10 21:23
grafiksinc19-May-10 21:23 
<br />
  <asp:DropDownList ID="provider" runat="server"                             DataSourceID="dr" DataTextField="provider"                             DataValueField="provider" AutoPostBack="True" AppendDataboundItems="true" OnSelectedIndexChanged="dd_OnSelectedIndexChanged"                             SelectedValue='<%# Bind("provider") %>'>                            <asp:ListItem Value=""></asp:ListItem>                         </asp:DropDownList>  <asp:DropDownList ID="provider" runat="server" <br />
                            DataSourceID="dr" DataTextField="provider" <br />
                            DataValueField="provider" AutoPostBack="True" AppendDataboundItems="true" OnSelectedIndexChanged="dd_OnSelectedIndexChanged"<br />
                             SelectedValue='<%# Bind("provider") %>'><br />
                            <asp:ListItem Value=""></asp:ListItem><br />
                         </asp:DropDownList>


Here is the Behind Code


Protected Sub dd_OnSelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
        '*******************************************************
        '*This will get the dropdownlist which has been clicked*
        '*******************************************************
        Dim ddl As DropDownList
        ddl = DirectCast(sender, DropDownList)
        '***********************************************************************
        '*The row will be the currently selected row from which the dropdownlist*
        '*was clicked                                                           *
        '***********************************************************************
        Dim row As GridViewRow = DirectCast(ddl.NamingContainer, GridViewRow)
        '******************************
        '*Get the datakey for that row*
        '******************************
        Dim DataKey As String = GridView1.DataKeys(row.RowIndex).Values("IEN").ToString()
        '**********************
        '*Define Data Objects *
        '**********************
        Dim conn As SqlConnection
        Dim comm As SqlCommand

        '******************************************
        '*Read the connectionstring from we.config*
        '******************************************
        Dim ConnectionString As String = ConfigurationManager.ConnectionStrings("ER_BloodHoundConnectionString").ConnectionString
        '***********************
        '*Initialize Connection*
        '***********************
        conn = New SqlConnection(ConnectionString)
        '****************
        '*Create Command*
        '****************
        comm = New SqlCommand("UPDATE VW_Paitent SET provider=@provider WHERE IEN=@IEN", conn)
        '************************
        '*Add command Perameters*
        '************************
        comm.Parameters.Add("@Provider", System.Data.SqlDbType.NVarChar, 50)
        comm.Parameters("@Provider").Value = ddl.SelectedItem.Value

        comm.Parameters.Add("@IEN", System.Data.SqlDbType.Float)
        comm.Parameters("@IEN").Value = DataKey
        '*******************************************
        '*Enclose Database code in Try catch Finaly*
        '*******************************************
        Try
            '*********************
            '*Open the connection*
            '*********************
            conn.Open()
            '*********************
            '*Execute The command*
            '*********************
            comm.ExecuteNonQuery()
        Finally
            '**********************
            '*Close the connection*
            '**********************
            conn.Close()
        End Try
    End SubProtected Sub dd_OnSelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
        '*******************************************************
        '*This will get the dropdownlist which has been clicked*
        '*******************************************************
        Dim ddl As DropDownList
        ddl = DirectCast(sender, DropDownList)
        '***********************************************************************
        '*The row will be the currently selected row from which the dropdownlist*
        '*was clicked                                                           *
        '***********************************************************************
        Dim row As GridViewRow = DirectCast(ddl.NamingContainer, GridViewRow)
        '******************************
        '*Get the datakey for that row*
        '******************************
        Dim DataKey As String = GridView1.DataKeys(row.RowIndex).Values("IEN").ToString()
        '**********************
        '*Define Data Objects *
        '**********************
        Dim conn As SqlConnection
        Dim comm As SqlCommand

        '******************************************
        '*Read the connectionstring from we.config*
        '******************************************
        Dim ConnectionString As String = ConfigurationManager.ConnectionStrings("ER_BloodHoundConnectionString").ConnectionString
        '***********************
        '*Initialize Connection*
        '***********************
        conn = New SqlConnection(ConnectionString)
        '****************
        '*Create Command*
        '****************
        comm = New SqlCommand("UPDATE VW_Paitent SET provider=@provider WHERE IEN=@IEN", conn)
        '************************
        '*Add command Perameters*
        '************************
        comm.Parameters.Add("@Provider", System.Data.SqlDbType.NVarChar, 50)
        comm.Parameters("@Provider").Value = ddl.SelectedItem.Value

        comm.Parameters.Add("@IEN", System.Data.SqlDbType.Float)
        comm.Parameters("@IEN").Value = DataKey
        '*******************************************
        '*Enclose Database code in Try catch Finaly*
        '*******************************************
        Try
            '*********************
            '*Open the connection*
            '*********************
            conn.Open()
            '*********************
            '*Execute The command*
            '*********************
            comm.ExecuteNonQuery()
        Finally
            '**********************
            '*Close the connection*
            '**********************
            conn.Close()
        End Try
    End Sub

GeneralRe: Update a Database Using Dropdownlist in ASP VB.Net Pin
grafiksinc19-May-10 21:25
grafiksinc19-May-10 21:25 
QuestionHow to keep tag open in XML file if no data available? Pin
rahul.net1118-May-10 21:03
rahul.net1118-May-10 21:03 
QuestionRender a custom ASP.NET user control to excel ? Pin
Gagan111818-May-10 20:56
Gagan111818-May-10 20:56 
QuestionFinal Year Project Pin
Nasri8718-May-10 15:42
Nasri8718-May-10 15:42 
AnswerRe: Final Year Project Pin
Not Active18-May-10 15:52
mentorNot Active18-May-10 15:52 
AnswerRe: Final Year Project Pin
neal12318-May-10 19:02
neal12318-May-10 19:02 
AnswerRe: Final Year Project Pin
Sandeep Mewara18-May-10 19:33
mveSandeep Mewara18-May-10 19:33 
AnswerRe: Final Year Project Pin
Gaurav Dudeja India18-May-10 20:29
Gaurav Dudeja India18-May-10 20:29 
AnswerRe: Final Year Project Pin
Nasri872-Jun-10 20:45
Nasri872-Jun-10 20:45 
QuestionCouldn't understand this code Pin
netJP12L18-May-10 10:44
netJP12L18-May-10 10:44 
AnswerRe: Couldn't understand this code Pin
Not Active18-May-10 11:10
mentorNot Active18-May-10 11:10 
AnswerRe: Couldn't understand this code Pin
Yusuf18-May-10 14:03
Yusuf18-May-10 14:03 
QuestionUpdating textbox Pin
Dhyanga18-May-10 9:09
Dhyanga18-May-10 9:09 
AnswerRe: Updating textbox Pin
Sandeep Mewara18-May-10 9:39
mveSandeep Mewara18-May-10 9:39 
GeneralRe: Updating textbox Pin
Dhyanga18-May-10 9:43
Dhyanga18-May-10 9:43 
GeneralRe: Updating textbox Pin
Sandeep Mewara18-May-10 9:48
mveSandeep Mewara18-May-10 9:48 
GeneralRe: Updating textbox Pin
Dhyanga18-May-10 9:54
Dhyanga18-May-10 9:54 

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.