Thanks all. Problem solved. See previous post.:cool:
grafiksinc
Posts
-
Update a Database Using Dropdownlist in ASP VB.Net -
Update a Database Using Dropdownlist in ASP VB.Net<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" DataSourceID="dr" DataTextField="provider" DataValueField="provider" AutoPostBack="True" AppendDataboundItems="true" OnSelectedIndexChanged="dd_OnSelectedIndexChanged" SelectedValue='<%# Bind("provider") %>'> <asp:ListItem Value=""></asp:ListItem> </asp:DropDownList>
Here is the Behind CodeProtected 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\* '\*\*\*\*\*\*\*\*\*\*\*
-
Update a Database Using Dropdownlist in ASP VB.NetYes I am asking for hep is wrting that. Thanks,
-
Update a Database Using Dropdownlist in ASP VB.NetHello all, First off I am using VB.net I have a dropdown list in the Item template. I would like the user to select a value and update the database without clicking an update button. Here is the Code for the DDL
<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="SqlDataSource2" DataTextField="provider"
DataValueField="provider" AutoPostBack="True" AppendDataboundItems="true" OnSelectedIndexChanged = "ddl_SelectedChange"
SelectedValue='<%# Bind("provider") %>'>
<asp:ListItem Value=""></asp:ListItem>
</asp:DropDownList>here is my Behind code I am not sure what to put after the Dim statement
Protected Sub ddl_SelectedChange(ByVal sender As Object, ByVal e As System.EventArgs)
Dim ddl = DirectCast(sender, DropDownList)Any help would be greatly appreciated
-
How to Hide A GridView Column in a Visual Web Developer projectHello All, Well I did try your suggestions howerver nothing worked. I think next time I will manually create the Table and writ ethe code rathe rthan use the Gridview for this tyoe of situation. With that said here is what i did. 1. Convert the column to a template 2. The columns that I want to hide - site the width to 0 3. In the ItemTemplate just remove the text so that the column title is is blank 4. On the ASP: Code set GridLines = None 5. In the edit template Put the text/check box you want to use Doing the above steps allowed me to hide the columns in "Normal mode" and have them show in edit mode. Thanks guys for all the help, Tommy :laugh:
-
How to Hide A GridView Column in a Visual Web Developer projectDinesh, I did find this however I am not too familiar with c# If you could help translate this toe VB.net that would be fantastic. Thanks, Tommy :laugh:
-
How to Hide A GridView Column in a Visual Web Developer projectPranay, I did take that in to account to be sure I did change to 10 see the result. Its was the same but just on the 10th column. I still get the StackOverflowExceptionwasunhandled As if its looping but I don't understand why. Thanks,
-
How to Hide A GridView Column in a Visual Web Developer projectHello All, I have a Web Application I am developing that has a GridView. I have searched the internet to no avail looking for an answer to this. The gridview has 11 columns. I want to hide the 11th column while in normal mode and make visible while in edit mode. Here is my Code: Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound If e.Row.RowState = DataControlRowState.Edit Then GridView1.Columns(11).Visible = True ElseIf e.Row.RowState = DataControlRowState.Normal Then GridView1.Columns(11).Visible = False End If End Sub My result from the above code is The 11th column is not visible in Normal mode but when I click the Edit button an error StackOverflowExceptionwasunhandled comes up. What am I missing :confused: Thanks! Tommy