2012-05-08 4 views
0

실버 라이트를 초보자입니다. 실버 라이트 어플리케이션에서 from을 (를) 제출할 수 있습니까? asp.net의 silverlight 컨트롤 인스 타다를 사용하고 싶습니다. asp.net 컨트롤보다 훨씬 뛰어납니다. 실버 라이트에서 수행하는 방법 5실버 라이트에서 asp.net 페이지로 제출

답변

1

나는 확신 당신은 지금 당신의 대답을 가지고,하지만 나중에 독자,이 방법으로 가장 좋은 방법을 발견 Silverlight에서이 작업을 수행하십시오. 이렇게하면 aspx 페이지가 필요없고 실버 라이트에서 직접 html 페이지를 만들어 제출할 수 있습니다.

Silverlight 브라우저 interop을 사용하여 프로그래밍 방식으로 HTML 양식을 만들고 요소를 설정합니다.

//Creates a blank html document 
var htmldoc = System.Windows.Browser.HtmlPage.Document; 
// Returns a Reference type to the body of html page 
var body = htmldoc.Body; 

// Create a <form> element and add it to the body 
var newForm = htmldoc.CreateElement("form"); 
newForm.SetAttribute("action", targetUrl); 
newForm.SetAttribute("method", "post"); 
body.AppendChild(newForm); 

//Add your elements to your form 
HtmlElement input1 = htmldoc.CreateElement("input"); 
input1.SetAttribute("type", "hidden"); 
input1.SetAttribute("name", "someName"); 
input1.SetAttribute("value", "someValue"); 
newForm.AppendChild(input1); 

//submit your form 
newForm.Invoke("submit"); 

저 간단한!

원본 답 : This Answer

관련 문제