I am looking for example code to help me post the form a have created..in C# code.

I am looking for example code to help me post the form a have created..in C# code. see the code below.
//CREATE FORM ELEMENT
        HtmlGenericControl form = new HtmlGenericControl("form");
        form.Attributes.Add("name", "mysetcomform");
        form.Attributes.Add("id", "mysetcomform");
        form.Attributes.Add("method", "post");
        form.Attributes.Add("action", "https://www.setcom.com/secure/");
 
 
        //HIDDEN FIELDS 
        HtmlInputHidden merchantidentifier = new HtmlInputHidden();
        merchantidentifier.Name = "MerchantIdentifier";
        merchantidentifier.Value = merchantid;
 
        HtmlInputHidden mycurrency = new HtmlInputHidden();
        mycurrency.Name = "CurrencyAlphaCode";
        mycurrency.Value = currency;
 
        HtmlInputHidden LIDSKU = new HtmlInputHidden();
        LIDSKU.Name = "LIDSKU";
        LIDSKU.Value = lidsku;
 
        HtmlInputHidden LIDDesc = new HtmlInputHidden();
        LIDDesc.Name = "LIDDesc";
        LIDDesc.Value = desc;
 
        HtmlInputHidden LIDPrice = new HtmlInputHidden();
        LIDPrice.Name = "LIDPrice";
        LIDPrice.Value = price;
 
        HtmlInputHidden LIDQty = new HtmlInputHidden();
        LIDQty.Name = "LIDQty";
        LIDQty.Value = qty;
 
        HtmlInputHidden ShippingRequired = new HtmlInputHidden();
        ShippingRequired.Name = "ShippingRequired";
        ShippingRequired.Value = shippingrequired;
 
        //ADD CONTROLS ABOVE TO FORM
        form.Controls.Add(merchantidentifier);
        form.Controls.Add(mycurrency);
        form.Controls.Add(LIDSKU);
        form.Controls.Add(LIDDesc);
        form.Controls.Add(LIDPrice);
        form.Controls.Add(LIDQty);
        form.Controls.Add(ShippingRequired);
 
        //ADD FORM TO PARENT PAGE
 
        //Page.Controls.Add(form);
        container.Controls.Add(form);

Open in new window

LVL 2
diaFAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

davidmutoCommented:
You could try adding this  after container.Controls.Add(form) (line 50)
this.Page.ClientScript.RegiusterStartupScript(this.GetType(), "formsubmit", "document.mysetcomform.submit()", true);

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
davidmutoCommented:
Typo correction:
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "formsubmit", "document.mysetcomform.submit()", true);

Open in new window

0
diaFAuthor Commented:
Thanks for that man, But now I get an error saying "mysetcomform is null or not an object" in I.E 7...please help..
0
davidmutoCommented:
Is the name of your form still mysetcomform? Generally you want to write document.[nameofform].submit()
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.