Advertisement

05.28.2008 at 08:47AM PDT, ID: 23438504
[x]
Attachment Details

Find value in Gridview

Asked by ratkinso666 in Visual Studio .NET 2005, Programming for ASP.NET, Microsoft Visual Basic.Net

Tags: microsoft, Visual Studio, 2005, vb

Hi all, I have an ADD button that I added to a gridview, the idea is when I press the add button it adds that customer number to a dataset I have.  I am not sure of what control I need to get that customer number, you can see I am trying several different ones, but NONE are correct (Cust1,2 & 3).  Can someone please tell me what the correct way is for this.  The gridview is made up of fields that I converted to TemplateFields, not sure if that matters or not...  here is my button click event

Protected Sub BtnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim Cust1 As Integer = CInt(GridView1.DataKeys(e.RowIndex).Value)
        Dim Cust2 As String = CType(row.FindControl("Cu_CustomerNo"), TextBox).Text
        Dim Cust3 As TextBox = CType(e.Row.FindControl("Cu_CustomerNo"), TextBox)
        Dim sql1 As String = "INSERT INTO [tmpGMCCustomers] ([CustomerNumber]) VALUES (@CustomerNumber)"
        Using conn As New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("SQLReportsCorpReportsConnectionString").ConnectionString)
            Dim cmd As New SqlCommand(sql1, conn)
            cmd.Parameters.Add(New SqlParameter("@CustomerNumber", Cust))
            conn.Open()
            cmd.ExecuteNonQuery()
            cmd.Connection.Close()
        End Using
    End Sub

Thanks,
RandyStart Free Trial
[+][-]05.28.2008 at 10:54AM PDT, ID: 21662617

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.28.2008 at 11:14AM PDT, ID: 21662795

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.29.2008 at 06:12AM PDT, ID: 21668742

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.29.2008 at 06:57AM PDT, ID: 21669126

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.29.2008 at 07:09AM PDT, ID: 21669226

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.29.2008 at 07:14AM PDT, ID: 21669284

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.29.2008 at 07:16AM PDT, ID: 21669295

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.29.2008 at 07:18AM PDT, ID: 21669323

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.29.2008 at 07:20AM PDT, ID: 21669338

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.29.2008 at 07:34AM PDT, ID: 21669472

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.29.2008 at 07:40AM PDT, ID: 21669549

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.29.2008 at 07:50AM PDT, ID: 21669653

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.29.2008 at 08:38AM PDT, ID: 21670135

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.29.2008 at 08:39AM PDT, ID: 21670154

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.29.2008 at 09:02AM PDT, ID: 21670457

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.29.2008 at 09:32AM PDT, ID: 21670788

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.29.2008 at 10:55AM PDT, ID: 21671597

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Visual Studio .NET 2005, Programming for ASP.NET, Microsoft Visual Basic.Net
Tags: microsoft, Visual Studio, 2005, vb
Sign Up Now!
Solution Provided By: TheLearnedOne
Participating Experts: 1
Solution Grade: A
 
 
[+][-]05.29.2008 at 11:27AM PDT, ID: 21671932

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.29.2008 at 11:28AM PDT, ID: 21671940

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.29.2008 at 11:37AM PDT, ID: 21672009

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.29.2008 at 11:55AM PDT, ID: 21672212

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628