开发者

Problem passing filename between pages (query string)

I've tried and tried but just cannot get a hold of this so let me explain my problem.I have a survey website using xml survey files. On one page I have a category menu which passes relative surveys filename to another page in the redirect as a query string.

~/websurvey.aspx?Survey=gamesurvey.xml

so the name of the survey file is gamesurvey.xml. On another page I have the following to read the filename into a string.

string c = Request.QueryString["Survey"];

now here lies my problem. The control that I have to pass the filename to does not recognise any attempts I make at trying to "dereference" the string. Here is the part in question.

                <sstchur:WebSurvey id = "ws"
                                 SurveyFile =  "gamesurvey.xml"
                                   AnswersFile = "answers.xml"
                                   runat = "server"/>
              </form>             

Above where you see gamesurvey.xml thats where I need to pass the string. Here it is hardcoded.This is a problem because I want to be able to call any survey by way of query string without having to make new pages for each of them. If I put things like

""+c+"" or .toString() or SurveyFile = c

it tells me the server tag is not well formed. To sum up my problem I need to pass a filepath directly from page to page. By the way, when I put SurveyFile = c I get a pageload error saying the开发者_如何转开发 file c cannot be found, i.e. this control will only take a filename not a variable containing it.

Sorry if this is hard to understand but my head is just melted with it now I had to ask. Any help would be appreciated.

The control im using is the WebSurvey control 4GuysFromRolla and yes I have checked all the documentation and the few forum posts related to it.


And what prevents you from setting that control property in your code-behind?

If you've your "page.aspx.cs", just do that in the Page.Init Page.Load event and you'll be fine!

Maybe I'm wrong and you can't use code-behind or something like that.


i am giving u few options

use

        SurveyFile= <% c %>

or since you are not passing the full file path so ur file is not found. give it like ~//root//directory//filename.extension

or may be u can find some methods to set that parameter using the code behind page.

do tick my answer correct if found useful

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜