English 中文(简体)
要求使用带有从代码背后理论/价值观的java书写方法
原标题:Calling a javascript method with arguments / values from code-behind

难道我有办法从表面上说一刀切的方法,需要两个论点/价值? 请检查以下法典:

private void ddl_Eval_SelectedIndexChanged (Object sender, System.EventArgs e)
{

    dtEval = new DataTable();
    dtEval = data.GetEvaluation2();
    DataView dvEval = dtEval.DefaultView;

    string xmlDoc = String.Empty;

    foreach (DataRowView drvEval in dvEval)
    {
        if (drvEval.Row["EvaluationID"].ToString() == ddl_Eval.SelectedValue.ToString())
        {
            xmlDoc = drvEval.Row["EvalAnswers"].ToString();
        }
    }

    XDocument xdoc = new XDocument();
    xdoc = XDocument.Parse(xmlDoc);

    foreach (XElement child in xdoc.Root.Elements("Answer"))
    {
        //Response.Write(child.Attribute("item").Value + " " + child.Value + "<br />");

        //THIS IS WHERE I NEED TO PUT THE CODE SO I CAN SEND THE VALUE
        //OF THE ATTRIBUTE "item" AND THE VALUE OF THE child node itself.

    }

}

这里还有XML的阐述:

<ANSWERS>
  <Answer item="ddl_3">A</Answer>
  <Answer item="ddl_8">A</Answer>
  <Answer item="ddl_13">Y</Answer>
  <Answer item="ddl_16">Y</Answer>
  <Answer item="ddl_19">Y</Answer>
  <Answer item="ddl_22">N</Answer>
  <Answer item="ddl_26">Y</Answer>
  <Answer item="ddl_30">N</Answer>
  <Answer item="ddl_34">Y</Answer>
  <Answer item="ddl_38">N</Answer>
  <Answer item="ddl_42">StarLight</Answer>
</ANSWERS>

这里的网页是,我想用javascript来改变<条码>的选用数值<>。

是否可能? 我想提出这两个论点/价值,以便javascript能够改变<select>上我在该页上的控制。

问题回答

changing a data list

ddl_eval.items.clear()

foreach (XElement child in xdoc.Root.Elements("Answer"))
    {
       ddl_eval.items.add(child.Value,child.Attribute("item").Value);
    }

你们不需要贾瓦文——我这样说:

Response.write("<answers>")

foreach (XElement child in xdoc.Root.Elements("Answer"))
    {
       Response.Write(@"<answer item="""+child.Value+@""">"+child.Attribute("item").Value+"</answer>");
    }

Response.Write("</answers>");

此外,现代的html风格是使所有政党的下级案件(xml要求)。


您应使用<条码>。

它不妨研究这样的问题:

 this.Page.RegisterClientScriptBlock("some unique name",@"
<script language=""JavaScript"">
   alert(""Hi, I m some client script!"");
</script>");




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签