I'm working with a DataGrid UpdateCommand event and running into a problem.
The second column of the dg is the PK named "FlitchNum" . The datatype of
this PK is varchar(string) . In the event I need to obtain the value of this
field in order to pass it into a SQL command. However, when I use the
syntax: "Dim FlitchID As String = e.Item.Cells(1) .Text" nothing populates the
FlitchID variable. Below is the code. How do I simply select the textual
value of the contents of column 3? Thanks
-------------------------------------------------------------------------------------
Private Sub DataGrid1_Updat eCommand(ByVal source As Object, _
ByVal e As System.Web.UI.W ebControls.Data GridCommandEven tArgs) _
Handles DataGrid1.Updat eCommand
Dim DDL As DropDownList = _
CType(e.Item.Ce lls(2).Controls (1), DropDownList)
Dim NewShip As Integer = DDL.SelectedVal ue
Dim FlitchID As String = e.Item.Cells(1) .Text
Response.Write( FlitchID)
Dim SQL As String = _
"UPDATE tblLogs SET SpecieID=@Speci e WHERE FlitchID=@ID"
Dim Conn As SqlConnection = New SqlConnection(" integrated
security=SSPI;d ata source=sjserver 1;persist security info=False;init ial
catalog=sjerp")
Dim Cmd As New SqlCommand(SQL, Conn)
Cmd.Parameters. Add(New SqlParameter("@ Specie", NewShip))
Cmd.Parameters. Add(New SqlParameter("@ ID", FlitchID))
Conn.Open()
Cmd.ExecuteNonQ uery()
Conn.Close()
DataGrid1.EditI temIndex = -1
DataGrid1.DataB ind(
------------------------------------------------------------------------------------- 4 1293
MrMike <Mr****@discuss ions.microsoft. com> wrote: I'm working with a DataGrid UpdateCommand event and running into a problem. The second column of the dg is the PK named "FlitchNum" . The datatype of this PK is varchar(string) . In the event I need to obtain the value of this field in order to pass it into a SQL command. However, when I use the syntax: "Dim FlitchID As String = e.Item.Cells(1) .Text" nothing populates the FlitchID variable.
That sounds very strange. Does e.Item.Cells(1) .Text definitely have a
non-null value? How are you determining that FlitchID has not been set?
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Thanks for your reply. FlitchNum is the PK, so it cannot contain a null
value. This column is a template column, generated using the code below.
Should this make any difference? Thanks.
<asp:TemplateCo lumn HeaderText="Fli tch#">
<ItemTemplate >
<asp:HyperLin k runat="server" Text='<%# DataBinder.Eval (Container,
"DataItem.Flitc hNum") %> ' NavigateURL='<% # "Logs_Detail.as px?id=" &
DataBinder.Eval (Container, "DataItem.Flitc hNum") %>' Target="_self"
Name="HyperLink 1">
</asp:HyperLink>
</ItemTemplate>
</asp:TemplateCol umn>
"Jon Skeet [C# MVP]" wrote: MrMike <Mr****@discuss ions.microsoft. com> wrote: I'm working with a DataGrid UpdateCommand event and running into a problem. The second column of the dg is the PK named "FlitchNum" . The datatype of this PK is varchar(string) . In the event I need to obtain the value of this field in order to pass it into a SQL command. However, when I use the syntax: "Dim FlitchID As String = e.Item.Cells(1) .Text" nothing populates the FlitchID variable.
That sounds very strange. Does e.Item.Cells(1) .Text definitely have a non-null value? How are you determining that FlitchID has not been set?
-- Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
MrMike <Mr****@discuss ions.microsoft. com> wrote: Thanks for your reply. FlitchNum is the PK, so it cannot contain a null value.
That may be true in theory, but is it true in your particular case? It
seems more likely that that would be wrong than that variable
assignment is broken.
This column is a template column, generated using the code below. Should this make any difference? Thanks.
Don't know, I'm afraid...
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Your FlitchNum is stored in the HyperLink's Text attribute, not in the Text
attribute of the DataGrid's Cell.
You need to give your HyperLink an ID and use e.FindControl(" <ID>") to get
an instance of your control and cast it to the type of HyperLink. Then you
can extract the FlitchNum from the control's Text property.
"Jon Skeet [C# MVP]" wrote: MrMike <Mr****@discuss ions.microsoft. com> wrote: Thanks for your reply. FlitchNum is the PK, so it cannot contain a null value.
That may be true in theory, but is it true in your particular case? It seems more likely that that would be wrong than that variable assignment is broken.
This column is a template column, generated using the code below. Should this make any difference? Thanks.
Don't know, I'm afraid...
-- Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet If replying to the group, please do not mail me too This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: john |
last post by:
Hi,All Gurus:
It is kind of complicated, please bear with me and let me know if you have
any questions.
Thanks a lot in advance.
John
I have a csharp method, using emit to dynamically generate classes & method
depends on the meta table in the database,here is my problem
1) One method I generated works when it was called, but another set of
method does not work, it generate the following error
|
by: intrepid_dw |
last post by:
Hello, all.
I've created a C# dll that contains, among other things, two functions
dealing with byte arrays. The first is a function that returns a byte
array, and the other is intended to receive a byte array as one of its
parameters. The project is marked for COM interop, and that all
proceeds normally.
When I reference the type library in the VB6 project, and write the
code to call the function that returns the byte array, it works
|
by: Lokkju |
last post by:
I am pretty much lost here - I am trying to create a managed c++
wrapper for this dll, so that I can use it from c#/vb.net, however, it
does not conform to any standard style of coding I have seen. It is
almost like it is trying to implement it's own COM interfaces...
below is the header, and a link to the dll+code:
Zip file with header, example, and DLL:...
|
by: ajikoe |
last post by:
Hi,
I tried to follow the example in swig homepage.
I found error which I don't understand.
I use bcc32, I already include directory where my python.h exist in
bcc32.cfg.
/* File : example.c */
#include <time.h>
|
by: DC |
last post by:
The Code
<%@ import namespace="System" %>
<%@ import namespace="System.Web" %>
<%@ import namespace="System.Web.UI" %>
<%@ import namespace="System.Web.UI.HtmlControls" %>
<%@ import namespace="System.Web.UI.WebControls" %>
<%@ import namespace="System.Data" %>
<%@ import namespace="System.Data.OleDb" %>
| |
by: Ch Pravin |
last post by:
Hi All:
I am having the following xml which i need to convert to excel using xslt.
Please help me out.
Afghanistan.xml
<?xml version="1.0" encoding="utf-16"?>
<Languages BuildVersion="1,5,0815,0 " CountryName="Afghanistan" >
<Language locale="English">
|
by: phpfreak2007 |
last post by:
Hi all,
I am trying to upload file using VB HTTP Post method and winsock control . Can successfully upload the files when client machine is English OS, but create problem when upload from Chinese OS. Currently what i am doing is reading file in string and then build a html request and send these string data to upload. fuction which read a file content and buildhttp request is given below.. can anyone suggest what is the problem. is it so...
|
by: efrenba |
last post by:
Hi,
I came from delphi world and now I'm doing my first steps in C++. I'm
using C++builder because its ide is like delphi although I'm trying to
avoid the vcl.
I need to insert new features to an old program that I wrote in delphi
and it's a good opportunity to start with c++.
|
by: oktayarslan |
last post by:
Hi all;
I have a problem when inserting an element to a vector. All I want is
reading some data from a file and putting them into a vector. But the
program is crashing after pushing a data which has string value. I
really do not understand why push_back() function is trying to remove
previously inserted data.
Thanks for any help
|
by: aboalnodom |
last post by:
hello guys, i hope any one will help in this
i am designing a web application, the page i am workin on its the default.aspx
it contains dropdownboxes
the first 4 to choose the type and the second for to choose the value of the type
when you choose a type a dropdownlist will be filled of values that related of that type.
and when you choose a second type , it will also will filled the value that related of the second type, and it will...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |