Click here to Skip to main content
15,885,640 members
Home / Discussions / C#
   

C#

 
AnswerRe: c# Pin
ambarishtv29-Apr-11 22:51
ambarishtv29-Apr-11 22:51 
AnswerRe: c# Pin
Prasanta_Prince30-Apr-11 7:14
Prasanta_Prince30-Apr-11 7:14 
QuestionFile access permissions in program files folder Pin
lukeer29-Apr-11 3:46
lukeer29-Apr-11 3:46 
AnswerRe: File access permissions in program files folder Pin
dan!sh 29-Apr-11 5:26
professional dan!sh 29-Apr-11 5:26 
AnswerRe: File access permissions in program files folder Pin
Luc Pattyn29-Apr-11 8:09
sitebuilderLuc Pattyn29-Apr-11 8:09 
GeneralRe: File access permissions in program files folder Pin
lukeer1-May-11 21:04
lukeer1-May-11 21:04 
AnswerRe: File access permissions in program files folder Pin
Luc Pattyn1-May-11 22:50
sitebuilderLuc Pattyn1-May-11 22:50 
QuestionHow to add the data from list to a class objects Pin
Rocky2329-Apr-11 0:59
Rocky2329-Apr-11 0:59 
Hi can anyone tell me, how to bind a data to class objects from a list, so that i can pass it in xml request..

here is my code in xsd generated class.

<pre>public partial class SetValue
    {

        private string dANameField;

        private string dAIDField;

        private SetValueType setValueTypeField;

        /// &lt;remarks/&gt;
        public string DAName
        {
            get
            {
                return this.dANameField;
            }
            set
            {
                this.dANameField = value;
            }
        }

        /// &lt;remarks/&gt;
        public string DAID
        {
            get
            {
                return this.dAIDField;
            }
            set
            {
                this.dAIDField = value;
            }
        }

        /// &lt;remarks/&gt;
        public SetValueType SetValueType
        {
            get
            {
                return this.setValueTypeField;
            }
            set
            {
                this.setValueTypeField = value;
            }
        }
    }

    /// &lt;remarks/&gt;
    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://xml.abc.com/ns/msjava/lrm")]
    [System.Xml.Serialization.XmlRootAttribute(Namespace = "http://xml.abc.com/ns/msjava/lrm", IsNullable = false)]
    public partial class SetValueType
    {

        private string valueTypeIDField;

        private string valueTypeField;

        private string valueField;

        private Function functionField;

        private Field fieldField;

        /// &lt;remarks/&gt;
        public string ValueTypeID
        {
            get
            {
                return this.valueTypeIDField;
            }
            set
            {
                this.valueTypeIDField = value;
            }
        }

        /// &lt;remarks/&gt;
        public string ValueType
        {
            get
            {
                return this.valueTypeField;
            }
            set
            {
                this.valueTypeField = value;
            }
        }

        /// &lt;remarks/&gt;
        public string Value
        {
            get
            {
                return this.valueField;
            }
            set
            {
                this.valueField = value;
            }
        }

        /// &lt;remarks/&gt;
        public Function Function
        {
            get
            {
                return this.functionField;
            }
            set
            {
                this.functionField = value;
            }
        }

        /// &lt;remarks/&gt;
        public Field Field
        {
            get
            {
                return this.fieldField;
            }
            set
            {
                this.fieldField = value;
            }
        }
               
    }</pre>



here i have to do something, so that i can add the data in this list to class type(SetValueType), so that later i will convert it into xml format..

<pre> SetValue DAESetvalue = new SetValue
            {
                DAID=oSetValue.DAID,
                DAName=oSetValue.DAName
            };
            DADirective.SetValue = DAESetvalue;

List&lt;SetValueType&gt; SetValueTypeList = new List&lt;SetValueType&gt;();
GetValueTypeCondition(gValueTypeCondition,SetValueTypeList);
public void GetValueTypeCondition(Grid gValueTypeCondition,List&lt;SetValueType&gt; SetValueTypeList)
        {
            int rowcount = 0;
            if (gValueTypeCondition.RowDefinitions != null)
                rowcount = gValueTypeCondition.RowDefinitions.Count;
            for (int i = 0; i &lt; rowcount; i++)
            {
                SetValueType oSetValueType = new SetValueType();                
               // bool isValueType = false;
                foreach (UIElement element in gValueTypeCondition.Children.Cast&lt;UIElement&gt;().Where(element =&gt; Grid.GetRow(element) == i))
                {
                    if (element is ComboBox)
                    {
                       // isValueType = true;
                        ComboBox cbvaluetype = (ComboBox)element;

                        if (cbvaluetype.Uid != null)
                        {
                          Object obj = ((ComboBoxItem)(cbvaluetype.SelectedItem)).Tag;
                            if (obj != null)
                            {                              
                                if (cbvaluetype.Uid == DataKey.FUNCTION_KEY)
                                {
                                    DAFunction dafunction = (DAFunction)obj;
                                    oSetValueType.ValueTypeID = "2";
                                    oSetValueType.ValueType = "Function";

                                    oSetValueType.Function.FunctionID = dafunction.FunctionID;
                                    oSetValueType.Function.FunctionName = dafunction.FunctionName;
                                    oSetValueType.Function.DataType1 = dafunction.DataType1;
                                    oSetValueType.Function.DataType2 = dafunction.DataType2;
                                    oSetValueType.Function.DataType3 = dafunction.DataType3;
                                }
                                else if (cbvaluetype.Uid == DataKey.COLUMN_CONDITION_KEY)
                                {
                                    DAColumn dacobj = (DAColumn)obj;
                                    oSetValueType.ValueTypeID = "3";
                                    oSetValueType.ValueType = "Field";
                                    oSetValueType.Field.FieldID = dacobj.id;
                                    oSetValueType.Field.FieldValue = dacobj.name;
                                }
                            }
                        }
                    }
                    else if (element is TextBox)
                    {
                        TextBox txtValueType = (TextBox)element;
                        switch (txtValueType.Uid)
                        {
                            case DataKey.TEXT_VALUE_KEY:
                                oSetValueType.ValueTypeID = "1";
                                oSetValueType.ValueType = "Value";
                                oSetValueType.Value = txtValueType.Text.Replace("_", "").Trim();
                                break;
                            case DataKey.TEXT_FUNCTION_VALUE_KEY:
                                oSetValueType.Function.FunctionValue = txtValueType.Text.Replace("_", "").Trim();                                
                                break;
                        }
                    }
                }
                //if (isValueType)
                    SetValueTypeList.Add(oSetValueType);
            }
        }</pre>

so any help like how to do it...
QuestionRemoving "Back-Slash \" from string Pin
M Riaz Bashir28-Apr-11 23:09
M Riaz Bashir28-Apr-11 23:09 
AnswerRe: Removing "Back-Slash \" from string Pin
loveangel88828-Apr-11 23:15
loveangel88828-Apr-11 23:15 
GeneralRe: Removing "Back-Slash \" from string Pin
M Riaz Bashir28-Apr-11 23:23
M Riaz Bashir28-Apr-11 23:23 
GeneralRe: Removing "Back-Slash \" from string Pin
Richard MacCutchan29-Apr-11 0:46
mveRichard MacCutchan29-Apr-11 0:46 
AnswerRe: Removing "Back-Slash \" from string Pin
Blue_Boy28-Apr-11 23:18
Blue_Boy28-Apr-11 23:18 
AnswerRe: Removing "Back-Slash \" from string PinPopular
David198729-Apr-11 1:30
David198729-Apr-11 1:30 
AnswerRe: Removing "Back-Slash \" from string Pin
Prasanta_Prince29-Apr-11 5:49
Prasanta_Prince29-Apr-11 5:49 
AnswerRe: Removing "Back-Slash \" from string Pin
wizardzz29-Apr-11 7:23
wizardzz29-Apr-11 7:23 
QuestionBinding a Method Pin
dbongs28-Apr-11 21:52
dbongs28-Apr-11 21:52 
AnswerRe: Binding a Method Pin
Pete O'Hanlon28-Apr-11 23:03
mvePete O'Hanlon28-Apr-11 23:03 
GeneralRe: Binding a Method Pin
dbongs28-Apr-11 23:14
dbongs28-Apr-11 23:14 
GeneralRe: Binding a Method Pin
Pete O'Hanlon29-Apr-11 2:32
mvePete O'Hanlon29-Apr-11 2:32 
QuestionFileUpload Component question. Pin
buffering8328-Apr-11 19:38
buffering8328-Apr-11 19:38 
AnswerRe: FileUpload Component question. Pin
dan!sh 28-Apr-11 20:04
professional dan!sh 28-Apr-11 20:04 
AnswerRe: FileUpload Component question. Pin
Pete O'Hanlon28-Apr-11 21:00
mvePete O'Hanlon28-Apr-11 21:00 
AnswerRe: FileUpload Component question. Pin
dbongs28-Apr-11 21:54
dbongs28-Apr-11 21:54 
QuestionHow to print a file (word doc, pdf or infopath form) from a URL using code? Pin
bin_bin128-Apr-11 19:21
bin_bin128-Apr-11 19:21 

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.