Victor Charles
asked on
Help with retreiving text data with concatenate method
Hello,
I've made some progress with the code below, but I'm running into two issuse.
1. The value retrieved from the controls is for example c1Receiver.text insatead of the actual values displayed
2. The prgram only saves data to the last xml file in the string (i.e. Receiver.xml), but I need to save the text values of the controls to all the xml files that are part of curXYZ.
How do I solve those two issues?
Thanks,
Victor
I've made some progress with the code below, but I'm running into two issuse.
1. The value retrieved from the controls is for example c1Receiver.text insatead of the actual values displayed
2. The prgram only saves data to the last xml file in the string (i.e. Receiver.xml), but I need to save the text values of the controls to all the xml files that are part of curXYZ.
How do I solve those two issues?
Dim xyz() As String = New String() {"Manufacturer", "Receiver"}
Dim i As Integer
i = 0
For i = 0 To 1
Dim curXYZ = xyz(i)
Dim MyFix As XDocument = XDocument.Load(Server.MapPath("~/App_Data/" & curXYZ & ".xml"))
Dim xid As String
xid = curXYZ & "_ID"
Dim LargestFixID = (From el In MyFix.Descendants(curXYZ & "Table") Select CInt(el.<xid>.Value)).ToList
LargestFixID.Sort()
Dim xtable As String
xtable = curXYZ & "Table"
Dim xcontrol1 As String
xcontrol1 = "Me.C1" & curXYZ & ".Text"
Dim xcontrol As String
xcontrol = "Me.C1" & curXYZ & ".Text.ToString"
Dim CheckForItemFix = (From el In MyFix.Descendants(xtable).Elements(curXYZ) Select el.Value).ToList
If Not CheckForItemFix.Contains(xcontrol1) Then
Dim xNew As XElement = New XElement(xtable)
xNew.Add(New XElement(xid, (LargestFixID.Last() + 1)))
xNew.Add(New XElement(curXYZ, xcontrol1))
MyFix.Root.Add(xNew)
MyFix.Save(Server.MapPath("~/App_Data/" & curXYZ & ".xml"))
End If
Dim searchFix As String = xcontrol1
Dim searchIdFix As String = Nothing
Dim domFix As New XmlDocument()
domFix.Load(Server.MapPath("~/App_Data/" & curXYZ & ".xml"))
Dim listFix As XmlNodeList = domFix.SelectNodes("//" & xtable)
If CheckForItemFix.Contains(xcontrol1) Then
For Each node As XmlNode In listFix
If node(curXYZ).InnerText.Equals(searchFix) Then
searchIdFix = node(xid).InnerText
Exit For
End If
Next
End If
Next
Thanks,
Victor
ASKER
Thanks for the code , do you have a suggestion to solve the second issue?
I would like to avoid writing a separate If statement for MyFix for each value of curXYZ
If Not CheckForItemFix.Contains(x control1) Then
Dim xNew As XElement = New XElement(xtable)
xNew.Add(New XElement(xid, (LargestFixID.Last() + 1)))
xNew.Add(New XElement(curXYZ, xcontrol1))
MyFix.Root.Add(xNew)
MyFix.Save(Server.MapPath( "~/App_Dat a/" & curXYZ & ".xml"))
End If
I would like to avoid writing a separate If statement for MyFix for each value of curXYZ
If Not CheckForItemFix.Contains(x
Dim xNew As XElement = New XElement(xtable)
xNew.Add(New XElement(xid, (LargestFixID.Last() + 1)))
xNew.Add(New XElement(curXYZ, xcontrol1))
MyFix.Root.Add(xNew)
MyFix.Save(Server.MapPath(
End If
Do another For surrounding this code which creates a new curXYZ2 so that both can be used if necessary, but certainly to not interfere between each other.
ASKER
Hello,
When I try Me.Controls("C1" & curXYZ).Text
I receive the following error: "Text is not a member of 'System.Web.UI.Control"
Victor
When I try Me.Controls("C1" & curXYZ).Text
I receive the following error: "Text is not a member of 'System.Web.UI.Control"
Victor
Oh yes ! I shall have seen it from the instruction Server.MapPath that your are writing an ASP.NET page in VB.NET. Just a hint, when you post a question in this condition, you shall put both tags for the question (easy for experts to get).
So next, Text property doesn't exist in the class System.Web.UI.Control. What is the type of control you are accessing ? If they are all of the same type and this type has a Text property, then you can cast to your control type.
CType(Me.Controls("C1" & curXYZ), !!!MYTYPE!!!).Text
You have to replace !!!MYTYPE!!! with the real type of the control you use.
If your control doesn't have the Text property, then you should access the appropriate property to get what you need.
Looking into MSDN or Object browsers (into Visual Studio), you can know all the members (properties, methods, events, etc) of any class you need.
So next, Text property doesn't exist in the class System.Web.UI.Control. What is the type of control you are accessing ? If they are all of the same type and this type has a Text property, then you can cast to your control type.
CType(Me.Controls("C1" & curXYZ), !!!MYTYPE!!!).Text
You have to replace !!!MYTYPE!!! with the real type of the control you use.
If your control doesn't have the Text property, then you should access the appropriate property to get what you need.
Looking into MSDN or Object browsers (into Visual Studio), you can know all the members (properties, methods, events, etc) of any class you need.
ASKER
Hello,
Yes it does have a text property, I am using a control from ComponentOne. The properties windows shows the following:
C1Receiver C1.Web.UI.Controls.C1Combo Box.C1Comb oBox.
Should the code be CType(Me.Controls("C1" & curXYZ), C1ComboBox.C1ComboBox).Tex t
Thanks,
Victor
Yes it does have a text property, I am using a control from ComponentOne. The properties windows shows the following:
C1Receiver C1.Web.UI.Controls.C1Combo
Should the code be CType(Me.Controls("C1" & curXYZ), C1ComboBox.C1ComboBox).Tex
Thanks,
Victor
Shall be
ASKER
Hi,
I received the following error:
Conversion from string "C1Manufacturer" to type 'Integer' is not valid.
with code:
Dim xcontrol1 As String
xcontrol1 = CType(Me.Controls("C1" & curXYZ), C1ComboBox).Text
Same error occured with
Dim xcontrol1 As String
xcontrol1 = CType(Me.Controls("C1" & curXYZ), C1ComboBox.C1ComboBox).Tex t
Victor
I received the following error:
Conversion from string "C1Manufacturer" to type 'Integer' is not valid.
with code:
Dim xcontrol1 As String
xcontrol1 = CType(Me.Controls("C1" & curXYZ), C1ComboBox).Text
Same error occured with
Dim xcontrol1 As String
xcontrol1 = CType(Me.Controls("C1" & curXYZ), C1ComboBox.C1ComboBox).Tex
Victor
Ok. I'll give you directly the solution, but I really think you should read the MSDN to at least understand the classes you're using. I'll give you an example.
In the instruction : CType(Me.Controls("C1" & curXYZ), C1ComboBox).Text
Me refers to a System.Web.UI.Page class. (Supposed here, but quiet sure due to the error message you gave me)
Controls refers to a System.Web.UI.ControlColle ction class.
(...) refers to the property Item of the ControlCollection class returned by the Controls property of the Page class.
In fact, it is : CType(Me.Controls.Item("C1 " & curXYZ), C1ComboBox).Text
All the classes named here could be found into MSDN using google or within search engine. You can scan all the properties and their description just to learn the possibilities offered by these classes. Making that, you won't remember all of that, but at least some and more, you're comprehension of all this will grow up.
So, here, your bug occurs because the Item property requires one parameter which is an Integer. As specified in the message error. So now, we understand that accessing the control by the ID (here I presume that "C1" & curXYZ is the ID) can't be done with this property.
Looking around, you would found a method on Control class called FindControl which allows you to search by ID a control. So the instruction would become :
CType(Me.FindControl("C1" & curXYZ), C1ComboBox).Text
------
I always promote experience learning which makes your knowledge growing, but also your competency to reach information and others aside.
In the instruction : CType(Me.Controls("C1" & curXYZ), C1ComboBox).Text
Me refers to a System.Web.UI.Page class. (Supposed here, but quiet sure due to the error message you gave me)
Controls refers to a System.Web.UI.ControlColle
(...) refers to the property Item of the ControlCollection class returned by the Controls property of the Page class.
In fact, it is : CType(Me.Controls.Item("C1
All the classes named here could be found into MSDN using google or within search engine. You can scan all the properties and their description just to learn the possibilities offered by these classes. Making that, you won't remember all of that, but at least some and more, you're comprehension of all this will grow up.
So, here, your bug occurs because the Item property requires one parameter which is an Integer. As specified in the message error. So now, we understand that accessing the control by the ID (here I presume that "C1" & curXYZ is the ID) can't be done with this property.
Looking around, you would found a method on Control class called FindControl which allows you to search by ID a control. So the instruction would become :
CType(Me.FindControl("C1" & curXYZ), C1ComboBox).Text
------
I always promote experience learning which makes your knowledge growing, but also your competency to reach information and others aside.
ASKER
Thank you, I will try it and get back to you.
ASKER
Hi,
I tried it but received the folowig error: Object reference not set to an instance of an object.
I am not trying the retreive the ID, the xcontrol1 should return the text values of the combobos controls.
Below is a part of the code curXYZ based on the value I received for xtable, curXYZ is returning the correct data (i.e. ReceiverTable)
Dim xtable As String
xtable = curXYZ & "Table"
Dim xcontrol1 As String
MsgBox(xtable)
xcontrol1 = CType(Me.FindControl("C1" & curXYZ), C1ComboBox).Text ***Error line
MsgBox(xcontrol1)
Thanks
Victor
I tried it but received the folowig error: Object reference not set to an instance of an object.
I am not trying the retreive the ID, the xcontrol1 should return the text values of the combobos controls.
Below is a part of the code curXYZ based on the value I received for xtable, curXYZ is returning the correct data (i.e. ReceiverTable)
Dim xtable As String
xtable = curXYZ & "Table"
Dim xcontrol1 As String
MsgBox(xtable)
xcontrol1 = CType(Me.FindControl("C1" & curXYZ), C1ComboBox).Text ***Error line
MsgBox(xcontrol1)
Thanks
Victor
I'm missing information to continue. Can I see the ASP.NET page ? How to you define the controls you try to access ?
How long have you been programming ?
How long have you been programming ?
ASKER
Hi,
I've been programming windows applications for long time, but mainly using SQL statements with crystal Report, recently started using LINQ and XM.
Below is my code:
Thanks,
Code ASPX:
<%@ Page Title="Home Page" Language="vb" MasterPageFile="~/Site.Mas ter" AutoEventWireup="false"
CodeBehind="Default.aspx.v b" Inherits="AOP28Web090811._ Default" %>
<%@ Register assembly="C1.Web.UI.Contro ls.4" namespace="C1.Web.UI.Contr ols.C1Grid View" tagprefix="cc1" %>
<%@ Register assembly="C1.Web.UI.Contro ls.4" namespace="C1.Web.UI.Contr ols.C1Comb oBox" tagprefix="cc2" %>
<%@ Register assembly="C1.Web.UI.Contro ls.4" namespace="C1.Web.UI.Contr ols.C1Inpu t" tagprefix="cc3" %>
<%@ Register assembly="C1.Web.UI.Contro ls.4" namespace="C1.Web.UI.Contr ols.C1Cale ndar" tagprefix="cc4" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="Head Content">
<style type="text/css">
</style>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="Main Content">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<h2 class="style177">
<strong>[Add] screen</strong></h2>
<p class="style3">
<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
<asp:View ID="View1" runat="server">
<table class="style1">
<tr>
<td class="style216" colspan="10">
<strong>Basic Item Data</strong></td>
</tr>
<tr>
<td class="style226">
100-Item Desigation</td>
<td class="style180">
<cc2:C1ComboBox ID="C1Item" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" DropDownPositioningMode="R ightTop"
EmptyText="" FooterText=""
ToolTip="Enter or Select Existing Item" UseEmbeddedVisualStyles="T rue"
VisualStyle="Vista" Height="21px" Width="162px" Text="Enter/Select">
</cc2:C1ComboBox>
</td>
<td class="style209">
<asp:Button ID="Button10" runat="server" Height="24px" style="text-align: left"
Text="?" Width="16px" />
</td>
<td class="style209" colspan="2">
<asp:Button ID="Button16" runat="server" Text="Search Item" Width="47px" />
<asp:Button ID="Button19" runat="server" Text="Button" />
</td>
<td class="style221">
<asp:Label ID="Label1" runat="server" Text="Replace with" Visible="False"></asp:Labe l>
</td>
<td class="style228">
<cc2:C1ComboBox ID="C1ItemReplace" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" DropDownPositioningMode="R ightTop"
EmptyText="" FooterText="" Height="21px" Text="Enter/Select"
ToolTip="Enter or Select Existing Item" UseEmbeddedVisualStyles="T rue"
VisualStyle="Vista" Width="162px" Visible="False">
</cc2:C1ComboBox>
</td>
<td class="style221">
130- Date</td>
<td class="style185">
<cc2:C1ComboBox ID="C1Date" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" style="text-align: justify"
Text="" Height="22px" IsEditable="False"
UseEmbeddedVisualStyles="T rue" VisualStyle="Vista">
</cc2:C1ComboBox>
</td>
<td class="style185">
<asp:Button ID="Button13" runat="server" Height="24px" style="text-align: left"
Text="?" Width="16px" />
</td>
</tr>
<tr>
<td class="style226">
110-Item Type</td>
<td class="style180">
<cc2:C1ComboBox ID="C1ItemType" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Select"
DropDownPositioningMode="R ightTop" DropDownResizable="True"
TemplateItemHighlighted="F alse" UseEmbeddedVisualStyles="T rue"
VisualStyle="Vista" ForceSelectionText="True" IsEditable="False">
</cc2:C1ComboBox>
</td>
<td class="style209">
<asp:Button ID="Button11" runat="server" Height="24px" style="text-align: left"
Text="?" Width="16px" />
</td>
<td class="style181" colspan="5">
120 - ItemA Type</td>
<td class="style185">
<cc2:C1ComboBox ID="C1ItemAType" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" DropDownPositioningMode="T opLeft"
style="text-align: left" Text="Select" UseEmbeddedVisualStyles="T rue"
VisualStyle="Vista" IsEditable="False">
</cc2:C1ComboBox>
</td>
<td class="style185">
<asp:Button ID="Button14" runat="server" Height="24px" style="text-align: left"
Text="?" Width="16px" />
</td>
</tr>
<tr>
<td class="style211">
101-Manufacturer</td>
<td class="style212">
<cc2:C1ComboBox ID="C1Manufacturer" runat="server"
UseEmbeddedVisualStyles="T rue" VisualStyle="Vista"
DropDownPositioningMode="R ightTop" Text="Enter/Select">
</cc2:C1ComboBox>
</td>
<td class="style213">
<asp:Button ID="Button12" runat="server" Height="24px" style="text-align: left"
Text="?" Width="16px" />
</td>
<td class="style214" colspan="5">
111-Self Activation</td>
<td class="style219">
<cc2:C1ComboBox ID="C1SelfActivation" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Select" IsEditable="False"
UseEmbeddedVisualStyles="T rue" VisualStyle="Vista">
</cc2:C1ComboBox>
</td>
<td class="style219">
<asp:Button ID="Button15" runat="server" Height="24px" style="text-align: left"
Text="?" Width="16px" />
</td>
</tr>
<tr>
<td class="style200">
<span class="style199">140- Illustration</span></td>
<td class="style206">
<cc2:C1ComboBox ID="C1Illustration" runat="server"
DropDownPositioningMode="R ightTop" ShowTrigger="False" Text=""
UseEmbeddedVisualStyles="T rue" VisualStyle="Vista">
</cc2:C1ComboBox>
</td>
<td colspan="2">
<asp:Button ID="Button1" runat="server" Height="24px" Text="Load Image...."
Width="156px" />
</td>
<td colspan="4">
<asp:Button ID="Button18" runat="server" Text="Show" />
</td>
</tr>
<tr><td colspan="10">=<asp:Image ID="Image1" runat="server" Height="370px"
Width="424px" />
</td>
</tr>
</table>
</asp:View>
<asp:View ID="View2" runat="server">
<table class="style1">
<tr>
<td class="style170" colspan="2">
<strong><span class="style178">Identific ation</spa n></strong ></td>
<td class="style173">
</td>
<td class="style185">
</td>
</tr>
<tr>
<td class="style204">
200-Country Org</td>
<td class="style196">
<cc2:C1ComboBox ID="C1CountryOrigin" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" MaxLength="3" Text="Select"
Height="20px" IsEditable="False" UseEmbeddedVisualStyles="T rue"
VisualStyle="Vista" DropDownPositioningMode="R ightTop" Width="51px">
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style204">
210-User Country</td>
<td class="style196">
<cc2:C1ComboBox ID="C1CountryUser" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Select"
IsEditable="False" UseEmbeddedVisualStyles="T rue" VisualStyle="Vista"
DropDownPositioningMode="R ightTop" Width="51px">
</cc2:C1ComboBox>
</td>
<td class="style49" colspan="2" rowspan="17">
</td>
</tr>
<tr>
<td class="style204">
230-User(s)</td>
<td class="style196">
<cc2:C1ComboBox ID="C1Users" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Select"
IsEditable="False" UseEmbeddedVisualStyles="T rue" VisualStyle="Vista"
DropDownPositioningMode="R ightTop" Width="51px">
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style204">
220-Life Cycle St</td>
<td class="style196">
<cc2:C1ComboBox ID="C1LifeCycleStatus" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Select"
IsEditable="False" UseEmbeddedVisualStyles="T rue" VisualStyle="Vista"
DropDownPositioningMode="R ightTop" style="height: 22px">
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style194">
240-NSN (xxxx-xx-xxx-xxxx)</td>
<td class="style195">
<cc2:C1ComboBox ID="C1NSN" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Enter/Select"
UseEmbeddedVisualStyles="T rue" VisualStyle="Vista"
DropDownPositioningMode="R ightTop">
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style204">
250-ItemA Type</td>
<td class="style196">
<cc2:C1ComboBox ID="C1ItemAType" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Select"
IsEditable="False" UseEmbeddedVisualStyles="T rue" VisualStyle="Vista"
DropDownPositioningMode="R ightTop">
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style190" colspan="2">
<strong>ItemB Levels</strong></td>
</tr>
<tr>
<td class="style191" rowspan="0">
260-Rotation Min. (xxx,xxx)</td>
<td class="style192" rowspan="0">
<cc2:C1ComboBox ID="C1RotationMinimum" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Enter/Select"
UseEmbeddedVisualStyles="T rue" VisualStyle="Vista"
DropDownPositioningMode="R ightTop" style="text-align: justify">
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style204">
261-Rotation Max. (xxx,xxx)</td>
<td class="style196">
<cc2:C1ComboBox ID="C1RotationMaximum" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Enter/Select"
UseEmbeddedVisualStyles="T rue" VisualStyle="Vista"
DropDownPositioningMode="R ightTop">
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style204">
262-Acceleration Min. (xxx,xxx)</td>
<td class="style196">
<cc2:C1ComboBox ID="C1ItemDesignation9" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Enter/Select"
DropDownPositioningMode="T opRight" UseEmbeddedVisualStyles="T rue"
VisualStyle="Vista">
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style204">
263-Acceleration Dur. Min (xx.xx)</td>
<td class="style196">
<cc2:C1ComboBox ID="C1ItemDesignation10" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Enter/Select"
VisualStyle="Vista">
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style204">
264-Acceleration Max (xxx,xxx)</td>
<td class="style196">
<cc2:C1ComboBox ID="C1ItemDesignation11" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Enter/Select"
VisualStyle="Vista">
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style204">
265-Acceleration Dur. Max(xx.xx)</td>
<td class="style196">
<cc2:C1ComboBox ID="C1ItemDesignation12" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Enter/Select"
VisualStyle="Vista">
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style187">
266-Min Programmable Time (xx)</td>
<td class="style188">
<cc2:C1ComboBox ID="C1ItemDesignation13" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Enter/Select"
VisualStyle="Vista">
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style204">
267-Max Programmable Time (xx)</td>
<td class="style196">
<cc2:C1ComboBox ID="C1ItemDesignation14" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Enter/Select"
UseEmbeddedVisualStyles="T rue" VisualStyle="Vista">
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style204">
268-Max Flight Time (xx,xxx)</td>
<td class="style196">
<cc2:C1ComboBox ID="C1ItemDesignation15" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Enter/Select"
VisualStyle="Vista">
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style204">
269-Features</td>
<td class="style196">
<cc2:C1ComboBox ID="C1ItemDesignation16" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Select"
VisualStyle="Vista">
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style204">
270-Course Correcting Features</td>
<td class="style196">
<cc2:C1ComboBox ID="C1ItemDesignation17" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Select"
VisualStyle="Vista">
</cc2:C1ComboBox>
</td>
</tr>
</table>
</asp:View>
</asp:MultiView>
<asp:Button ID="btnBack" runat="server" Text="Back" />
<asp:Button ID="btnNext" runat="server" Text="Next" />
<asp:Button ID="btnSave" runat="server" Text="Save" />
<asp:Button ID="btnPrev" runat="server" Text="<< Prev" />
<asp:Button ID="btnNextA" runat="server" Text="Next >>" />
<asp:Button ID="Button7" runat="server" Text="|< First" Width="67px" />
<asp:Button ID="Button8" runat="server" Text="Last >|" />
<asp:TextBox ID="RecordNumber" runat="server"></asp:TextB ox>
</p>
<script type="text/javascript"> //using C1ClientSide Event function
onBeforeCellUpdate(grid, args) {
var numberpattern = /\d{3}\-\d{2}\-\d{3}\-\d{5 }$/;
if (args.get_cell().get_colum n().get_da taField() == "Phone")
{
var Myinput = args.get_cell().get_value( );
var matchvalue = (Myinput.match(numberpatte rn)) ? true : false;
if (!matchvalue) { args.set_cancel(true);
window.alert("Please enter (999-99-999-99999) format only.");
args.get_cell().get_conten tControl() .getElemen tsByTagNam e("input") [0].focus( ); } } }
</script>
</asp:Content>
Code: Save button (i.e Save Manufacturer data)
Protected Sub Button19_Click(sender As Object, e As EventArgs) Handles Button19.Click
Dim xyz() As String = New String() {"Manufacturer"}
Dim i As Integer
i = 0
For i = 0 To 1
Dim curXYZ = xyz(i)
Dim MyFix As XDocument = XDocument.Load(Server.MapP ath("~/App _Data/" & curXYZ & ".xml"))
Dim xid As String
xid = curXYZ & "_ID"
Dim LargestFixID = (From el In MyFix.Descendants(curXYZ & "Table") Select CInt(el.<xid>.Value)).ToLi st
LargestFixID.Sort()
Dim xtable As String
xtable = curXYZ & "Table"
Dim xcontrol1 As String
' xcontrol1 = CType(Me.Controls("C1" & curXYZ), C1ComboBox).Text
MsgBox(xtable)
xcontrol1 = CType(Me.FindControl("C1" & curXYZ), C1ComboBox).Text.ToString
MsgBox(xcontrol1)
Dim xcontrol As String
xcontrol = "Me.C1" & curXYZ & ".Text.ToString"
MsgBox(xcontrol1)
Dim CheckForItemFix = (From el In MyFix.Descendants(xtable). Elements(c urXYZ) Select el.Value).ToList
If Not CheckForItemFix.Contains(x control1) Then
Dim xNew As XElement = New XElement(xtable)
xNew.Add(New XElement(xid, (LargestFixID.Last() + 1)))
xNew.Add(New XElement(curXYZ, xcontrol1))
MyFix.Root.Add(xNew)
MyFix.Save(Server.MapPath( "~/App_Dat a/" & curXYZ & ".xml"))
End If
Dim searchFix As String = xcontrol1
Dim searchIdFix As String = Nothing
Dim domFix As New XmlDocument()
domFix.Load(Server.MapPath ("~/App_Da ta/" & curXYZ & ".xml"))
Dim listFix As XmlNodeList = domFix.SelectNodes("//" & xtable)
If CheckForItemFix.Contains(x control1) Then
For Each node As XmlNode In listFix
If node(curXYZ).InnerText.Equ als(search Fix) Then
searchIdFix = node(xid).InnerText
Exit For
End If
Next
End If
Next
End Sub
'Declarations:
Imports System.Xml
Imports System
Imports System.Text
Imports C1.Web.UI.Controls.C1Combo Box
Imports C1.Web.UI.Controls
I've been programming windows applications for long time, but mainly using SQL statements with crystal Report, recently started using LINQ and XM.
Below is my code:
Thanks,
Code ASPX:
<%@ Page Title="Home Page" Language="vb" MasterPageFile="~/Site.Mas
CodeBehind="Default.aspx.v
<%@ Register assembly="C1.Web.UI.Contro
<%@ Register assembly="C1.Web.UI.Contro
<%@ Register assembly="C1.Web.UI.Contro
<%@ Register assembly="C1.Web.UI.Contro
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="Head
<style type="text/css">
</style>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="Main
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<h2 class="style177">
<strong>[Add] screen</strong></h2>
<p class="style3">
<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
<asp:View ID="View1" runat="server">
<table class="style1">
<tr>
<td class="style216" colspan="10">
<strong>Basic Item Data</strong></td>
</tr>
<tr>
<td class="style226">
100-Item Desigation</td>
<td class="style180">
<cc2:C1ComboBox ID="C1Item" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" DropDownPositioningMode="R
EmptyText="" FooterText=""
ToolTip="Enter or Select Existing Item" UseEmbeddedVisualStyles="T
VisualStyle="Vista" Height="21px" Width="162px" Text="Enter/Select">
</cc2:C1ComboBox>
</td>
<td class="style209">
<asp:Button ID="Button10" runat="server" Height="24px" style="text-align: left"
Text="?" Width="16px" />
</td>
<td class="style209" colspan="2">
<asp:Button ID="Button16" runat="server" Text="Search Item" Width="47px" />
<asp:Button ID="Button19" runat="server" Text="Button" />
</td>
<td class="style221">
<asp:Label ID="Label1" runat="server" Text="Replace with" Visible="False"></asp:Labe
</td>
<td class="style228">
<cc2:C1ComboBox ID="C1ItemReplace" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" DropDownPositioningMode="R
EmptyText="" FooterText="" Height="21px" Text="Enter/Select"
ToolTip="Enter or Select Existing Item" UseEmbeddedVisualStyles="T
VisualStyle="Vista" Width="162px" Visible="False">
</cc2:C1ComboBox>
</td>
<td class="style221">
130- Date</td>
<td class="style185">
<cc2:C1ComboBox ID="C1Date" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" style="text-align: justify"
Text="" Height="22px" IsEditable="False"
UseEmbeddedVisualStyles="T
</cc2:C1ComboBox>
</td>
<td class="style185">
<asp:Button ID="Button13" runat="server" Height="24px" style="text-align: left"
Text="?" Width="16px" />
</td>
</tr>
<tr>
<td class="style226">
110-Item Type</td>
<td class="style180">
<cc2:C1ComboBox ID="C1ItemType" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Select"
DropDownPositioningMode="R
TemplateItemHighlighted="F
VisualStyle="Vista" ForceSelectionText="True" IsEditable="False">
</cc2:C1ComboBox>
</td>
<td class="style209">
<asp:Button ID="Button11" runat="server" Height="24px" style="text-align: left"
Text="?" Width="16px" />
</td>
<td class="style181" colspan="5">
120 - ItemA Type</td>
<td class="style185">
<cc2:C1ComboBox ID="C1ItemAType" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" DropDownPositioningMode="T
style="text-align: left" Text="Select" UseEmbeddedVisualStyles="T
VisualStyle="Vista" IsEditable="False">
</cc2:C1ComboBox>
</td>
<td class="style185">
<asp:Button ID="Button14" runat="server" Height="24px" style="text-align: left"
Text="?" Width="16px" />
</td>
</tr>
<tr>
<td class="style211">
101-Manufacturer</td>
<td class="style212">
<cc2:C1ComboBox ID="C1Manufacturer" runat="server"
UseEmbeddedVisualStyles="T
DropDownPositioningMode="R
</cc2:C1ComboBox>
</td>
<td class="style213">
<asp:Button ID="Button12" runat="server" Height="24px" style="text-align: left"
Text="?" Width="16px" />
</td>
<td class="style214" colspan="5">
111-Self Activation</td>
<td class="style219">
<cc2:C1ComboBox ID="C1SelfActivation" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Select" IsEditable="False"
UseEmbeddedVisualStyles="T
</cc2:C1ComboBox>
</td>
<td class="style219">
<asp:Button ID="Button15" runat="server" Height="24px" style="text-align: left"
Text="?" Width="16px" />
</td>
</tr>
<tr>
<td class="style200">
<span class="style199">140- Illustration</span></td>
<td class="style206">
<cc2:C1ComboBox ID="C1Illustration" runat="server"
DropDownPositioningMode="R
UseEmbeddedVisualStyles="T
</cc2:C1ComboBox>
</td>
<td colspan="2">
<asp:Button ID="Button1" runat="server" Height="24px" Text="Load Image...."
Width="156px" />
</td>
<td colspan="4">
<asp:Button ID="Button18" runat="server" Text="Show" />
</td>
</tr>
<tr><td colspan="10">=<asp:Image ID="Image1" runat="server" Height="370px"
Width="424px" />
</td>
</tr>
</table>
</asp:View>
<asp:View ID="View2" runat="server">
<table class="style1">
<tr>
<td class="style170" colspan="2">
<strong><span class="style178">Identific
<td class="style173">
</td>
<td class="style185">
</td>
</tr>
<tr>
<td class="style204">
200-Country Org</td>
<td class="style196">
<cc2:C1ComboBox ID="C1CountryOrigin" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" MaxLength="3" Text="Select"
Height="20px" IsEditable="False" UseEmbeddedVisualStyles="T
VisualStyle="Vista" DropDownPositioningMode="R
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style204">
210-User Country</td>
<td class="style196">
<cc2:C1ComboBox ID="C1CountryUser" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Select"
IsEditable="False" UseEmbeddedVisualStyles="T
DropDownPositioningMode="R
</cc2:C1ComboBox>
</td>
<td class="style49" colspan="2" rowspan="17">
</td>
</tr>
<tr>
<td class="style204">
230-User(s)</td>
<td class="style196">
<cc2:C1ComboBox ID="C1Users" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Select"
IsEditable="False" UseEmbeddedVisualStyles="T
DropDownPositioningMode="R
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style204">
220-Life Cycle St</td>
<td class="style196">
<cc2:C1ComboBox ID="C1LifeCycleStatus" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Select"
IsEditable="False" UseEmbeddedVisualStyles="T
DropDownPositioningMode="R
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style194">
240-NSN (xxxx-xx-xxx-xxxx)</td>
<td class="style195">
<cc2:C1ComboBox ID="C1NSN" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Enter/Select"
UseEmbeddedVisualStyles="T
DropDownPositioningMode="R
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style204">
250-ItemA Type</td>
<td class="style196">
<cc2:C1ComboBox ID="C1ItemAType" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Select"
IsEditable="False" UseEmbeddedVisualStyles="T
DropDownPositioningMode="R
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style190" colspan="2">
<strong>ItemB Levels</strong></td>
</tr>
<tr>
<td class="style191" rowspan="0">
260-Rotation Min. (xxx,xxx)</td>
<td class="style192" rowspan="0">
<cc2:C1ComboBox ID="C1RotationMinimum" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Enter/Select"
UseEmbeddedVisualStyles="T
DropDownPositioningMode="R
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style204">
261-Rotation Max. (xxx,xxx)</td>
<td class="style196">
<cc2:C1ComboBox ID="C1RotationMaximum" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Enter/Select"
UseEmbeddedVisualStyles="T
DropDownPositioningMode="R
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style204">
262-Acceleration Min. (xxx,xxx)</td>
<td class="style196">
<cc2:C1ComboBox ID="C1ItemDesignation9" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Enter/Select"
DropDownPositioningMode="T
VisualStyle="Vista">
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style204">
263-Acceleration Dur. Min (xx.xx)</td>
<td class="style196">
<cc2:C1ComboBox ID="C1ItemDesignation10" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Enter/Select"
VisualStyle="Vista">
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style204">
264-Acceleration Max (xxx,xxx)</td>
<td class="style196">
<cc2:C1ComboBox ID="C1ItemDesignation11" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Enter/Select"
VisualStyle="Vista">
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style204">
265-Acceleration Dur. Max(xx.xx)</td>
<td class="style196">
<cc2:C1ComboBox ID="C1ItemDesignation12" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Enter/Select"
VisualStyle="Vista">
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style187">
266-Min Programmable Time (xx)</td>
<td class="style188">
<cc2:C1ComboBox ID="C1ItemDesignation13" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Enter/Select"
VisualStyle="Vista">
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style204">
267-Max Programmable Time (xx)</td>
<td class="style196">
<cc2:C1ComboBox ID="C1ItemDesignation14" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Enter/Select"
UseEmbeddedVisualStyles="T
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style204">
268-Max Flight Time (xx,xxx)</td>
<td class="style196">
<cc2:C1ComboBox ID="C1ItemDesignation15" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Enter/Select"
VisualStyle="Vista">
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style204">
269-Features</td>
<td class="style196">
<cc2:C1ComboBox ID="C1ItemDesignation16" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Select"
VisualStyle="Vista">
</cc2:C1ComboBox>
</td>
</tr>
<tr>
<td class="style204">
270-Course Correcting Features</td>
<td class="style196">
<cc2:C1ComboBox ID="C1ItemDesignation17" runat="server" AutoComplete="False"
AutoFilter="False" CausesValidation="False" Text="Select"
VisualStyle="Vista">
</cc2:C1ComboBox>
</td>
</tr>
</table>
</asp:View>
</asp:MultiView>
<asp:Button ID="btnBack" runat="server" Text="Back" />
<asp:Button ID="btnNext" runat="server" Text="Next" />
<asp:Button ID="btnSave" runat="server" Text="Save" />
<asp:Button ID="btnPrev" runat="server" Text="<< Prev" />
<asp:Button ID="btnNextA" runat="server" Text="Next >>" />
<asp:Button ID="Button7" runat="server" Text="|< First" Width="67px" />
<asp:Button ID="Button8" runat="server" Text="Last >|" />
<asp:TextBox ID="RecordNumber" runat="server"></asp:TextB
</p>
<script type="text/javascript"> //using C1ClientSide Event function
onBeforeCellUpdate(grid, args) {
var numberpattern = /\d{3}\-\d{2}\-\d{3}\-\d{5
if (args.get_cell().get_colum
{
var Myinput = args.get_cell().get_value(
var matchvalue = (Myinput.match(numberpatte
if (!matchvalue) { args.set_cancel(true);
window.alert("Please enter (999-99-999-99999) format only.");
args.get_cell().get_conten
</script>
</asp:Content>
Code: Save button (i.e Save Manufacturer data)
Protected Sub Button19_Click(sender As Object, e As EventArgs) Handles Button19.Click
Dim xyz() As String = New String() {"Manufacturer"}
Dim i As Integer
i = 0
For i = 0 To 1
Dim curXYZ = xyz(i)
Dim MyFix As XDocument = XDocument.Load(Server.MapP
Dim xid As String
xid = curXYZ & "_ID"
Dim LargestFixID = (From el In MyFix.Descendants(curXYZ & "Table") Select CInt(el.<xid>.Value)).ToLi
LargestFixID.Sort()
Dim xtable As String
xtable = curXYZ & "Table"
Dim xcontrol1 As String
' xcontrol1 = CType(Me.Controls("C1" & curXYZ), C1ComboBox).Text
MsgBox(xtable)
xcontrol1 = CType(Me.FindControl("C1" & curXYZ), C1ComboBox).Text.ToString
MsgBox(xcontrol1)
Dim xcontrol As String
xcontrol = "Me.C1" & curXYZ & ".Text.ToString"
MsgBox(xcontrol1)
Dim CheckForItemFix = (From el In MyFix.Descendants(xtable).
If Not CheckForItemFix.Contains(x
Dim xNew As XElement = New XElement(xtable)
xNew.Add(New XElement(xid, (LargestFixID.Last() + 1)))
xNew.Add(New XElement(curXYZ, xcontrol1))
MyFix.Root.Add(xNew)
MyFix.Save(Server.MapPath(
End If
Dim searchFix As String = xcontrol1
Dim searchIdFix As String = Nothing
Dim domFix As New XmlDocument()
domFix.Load(Server.MapPath
Dim listFix As XmlNodeList = domFix.SelectNodes("//" & xtable)
If CheckForItemFix.Contains(x
For Each node As XmlNode In listFix
If node(curXYZ).InnerText.Equ
searchIdFix = node(xid).InnerText
Exit For
End If
Next
End If
Next
End Sub
'Declarations:
Imports System.Xml
Imports System
Imports System.Text
Imports C1.Web.UI.Controls.C1Combo
Imports C1.Web.UI.Controls
Well, from that page you posted, the control C1Receiver doesn't exist.
So calling Me.FindControl with an ID nonexistent is returning Nothing. So after then, calling a method or property, like Text, on Nothing generates the error : Object reference not set to an instance of an object.
So, either you ensure that all the controls with the ID you need really exist or you add this piece of code.
So calling Me.FindControl with an ID nonexistent is returning Nothing. So after then, calling a method or property, like Text, on Nothing generates the error : Object reference not set to an instance of an object.
So, either you ensure that all the controls with the ID you need really exist or you add this piece of code.
If Me.FindControl("C1" & curXYZ) IsNot Nothing Then xcontrol1 = CType(Me.Controls("C1" & curXYZ), C1ComboBox).Text
ASKER
Hi,
I am testing the project with the C1manufacturer control
Dim xyz() As String = New String() {"Manufacturer"}
Only Manufacturer is included in the xyz() string.
it exist in the .aspx file:
<td class="style212">
<cc2:C1ComboBox ID="C1Manufacturer" runat="server"
UseEmbeddedVisualStyles="T rue" VisualStyle="Vista"
DropDownPositioningMode="R ightTop" Text="Enter/Select">
</cc2:C1ComboBox>
</td>
Victor
I am testing the project with the C1manufacturer control
Dim xyz() As String = New String() {"Manufacturer"}
Only Manufacturer is included in the xyz() string.
it exist in the .aspx file:
<td class="style212">
<cc2:C1ComboBox ID="C1Manufacturer" runat="server"
UseEmbeddedVisualStyles="T
DropDownPositioningMode="R
</cc2:C1ComboBox>
</td>
Victor
Ok, I presume then that the problem is coming from the fact that your control is not inside the page, but within a container.
Let's try then this recursive method :
Let's try then this recursive method :
Public Function searchControl(idToSearch As String, obj As Control) As Control
Dim foundControl As Control = obj.FindControl(idToSearch)
If foundControl IsNot Nothing Then Return foundControl
For i As Integer = 0 To obj.Controls.Count - 1
If obj.Controls(i).Count = 0 Then Continue For
foundControl = searchControl(idToSearch, obj.Controls(i))
If foundControl IsNot Nothing Then Return foundControl
Next
Return Nothing
End Function
ASKER
Hi,
Thanks for the code, when I add it to my button click event, what value to I pass to idToSearch?
Victor
Thanks for the code, when I add it to my button click event, what value to I pass to idToSearch?
Victor
Call the function like this :
searchControl("C1" & curXYZ, Me)
searchControl("C1" & curXYZ, Me)
ASKER
Hi,
I'm getting the folowing error message in the Function: "Count is not a member of System.Web.UI.Control"
The other problem I noticed when Using multiple files in the xyz() string, I am only able to save data for the last file in the list, is thetre a way MyFix variable to save the data for each file in the xyz() string?
Code:
Dim xyz() As String = New String() {"Manufacturer"}
Dim i As Integer
i = 0
For i = 0 To 1
Dim curXYZ = xyz(i)
Dim MyFix As XDocument = XDocument.Load(Server.MapP ath("~/App _Data/" & curXYZ & ".xml"))
Dim xid As String
xid = curXYZ & "_ID"
Dim LargestFixID = (From el In MyFix.Descendants(curXYZ & "Table") Select CInt(el.<xid>.Value)).ToLi st
LargestFixID.Sort()
Dim xtable As String
xtable = curXYZ & "Table"
Dim xcontrol1 As String = ""
searchControl("C1" & curXYZ, Me)
'If Me.FindControl("C1" & curXYZ) IsNot Nothing Then xcontrol1 = CType(Me.Controls("C1" & curXYZ), C1ComboBox).Text
MsgBox(xcontrol1)
Dim CheckForItemFix = (From el In MyFix.Descendants(xtable). Elements(c urXYZ) Select el.Value).ToList
If Not CheckForItemFix.Contains(x control1) Then
Dim xNew As XElement = New XElement(xtable)
xNew.Add(New XElement(xid, (LargestFixID.Last() + 1)))
xNew.Add(New XElement(curXYZ, xcontrol1))
MyFix.Root.Add(xNew)
MyFix.Save(Server.MapPath( "~/App_Dat a/" & curXYZ & ".xml"))
End If
Dim searchFix As String = xcontrol1
Dim searchIdFix As String = Nothing
Dim domFix As New XmlDocument()
domFix.Load(Server.MapPath ("~/App_Da ta/" & curXYZ & ".xml"))
Dim listFix As XmlNodeList = domFix.SelectNodes("//" & xtable)
If CheckForItemFix.Contains(x control1) Then
For Each node As XmlNode In listFix
If node(curXYZ).InnerText.Equ als(search Fix) Then
searchIdFix = node(xid).InnerText
Exit For
End If
Next
End If
Next
Public Function searchControl(ByVal idToSearch As String, ByVal obj As Control) As Control
Dim foundControl As Control = obj.FindControl(idToSearch )
If foundControl IsNot Nothing Then Return foundControl
For i As Integer = 0 To obj.Controls.Count - 1
If obj.Controls(i).Count = 0 Then Continue For
foundControl = searchControl(idToSearch, obj.Controls(i))
If foundControl IsNot Nothing Then Return foundControl
Next
Return Nothing
End Function
I'm getting the folowing error message in the Function: "Count is not a member of System.Web.UI.Control"
The other problem I noticed when Using multiple files in the xyz() string, I am only able to save data for the last file in the list, is thetre a way MyFix variable to save the data for each file in the xyz() string?
Code:
Dim xyz() As String = New String() {"Manufacturer"}
Dim i As Integer
i = 0
For i = 0 To 1
Dim curXYZ = xyz(i)
Dim MyFix As XDocument = XDocument.Load(Server.MapP
Dim xid As String
xid = curXYZ & "_ID"
Dim LargestFixID = (From el In MyFix.Descendants(curXYZ & "Table") Select CInt(el.<xid>.Value)).ToLi
LargestFixID.Sort()
Dim xtable As String
xtable = curXYZ & "Table"
Dim xcontrol1 As String = ""
searchControl("C1" & curXYZ, Me)
'If Me.FindControl("C1" & curXYZ) IsNot Nothing Then xcontrol1 = CType(Me.Controls("C1" & curXYZ), C1ComboBox).Text
MsgBox(xcontrol1)
Dim CheckForItemFix = (From el In MyFix.Descendants(xtable).
If Not CheckForItemFix.Contains(x
Dim xNew As XElement = New XElement(xtable)
xNew.Add(New XElement(xid, (LargestFixID.Last() + 1)))
xNew.Add(New XElement(curXYZ, xcontrol1))
MyFix.Root.Add(xNew)
MyFix.Save(Server.MapPath(
End If
Dim searchFix As String = xcontrol1
Dim searchIdFix As String = Nothing
Dim domFix As New XmlDocument()
domFix.Load(Server.MapPath
Dim listFix As XmlNodeList = domFix.SelectNodes("//" & xtable)
If CheckForItemFix.Contains(x
For Each node As XmlNode In listFix
If node(curXYZ).InnerText.Equ
searchIdFix = node(xid).InnerText
Exit For
End If
Next
End If
Next
Public Function searchControl(ByVal idToSearch As String, ByVal obj As Control) As Control
Dim foundControl As Control = obj.FindControl(idToSearch
If foundControl IsNot Nothing Then Return foundControl
For i As Integer = 0 To obj.Controls.Count - 1
If obj.Controls(i).Count = 0 Then Continue For
foundControl = searchControl(idToSearch, obj.Controls(i))
If foundControl IsNot Nothing Then Return foundControl
Next
Return Nothing
End Function
ASKER
Hello,
Is there a way to do
MyFix(i).Root.Add(xNew)
MyFix(i).Save(Server.MapPa th("~/App_ Data/" & curXYZ & ".xml"))
To avoid using an If ststement for each value of curXYZ?
Vctror
Is there a way to do
MyFix(i).Root.Add(xNew)
MyFix(i).Save(Server.MapPa
To avoid using an If ststement for each value of curXYZ?
Vctror
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for all your help.
Me.C1Manufacturer.Text
and not getting the text of this control.
for that, use :
Me.Controls("C1" & curXYZ).Text