小编Kir*_*nov的帖子

如何从url获取参数

我正在编写一个aspx,让用户检查文件名并创建一个具有该名称的文件

网址是

/sites/usitp/_layouts/CreateWebPage.aspx?List=%7b74AB081E-59FB-45A5-876D-
                             284607DA03C6%7d&RootFolder=%3bText=%27SD_RMDS%27
Run Code Online (Sandbox Code Playgroud)

如何解析参数'Text'并显示在文本框中?

<div>
    <asp:TextBox id="Name" runat="server" />
</div>
Run Code Online (Sandbox Code Playgroud)

aspx文本框就是这个,我试过了

<asp:TextBox id="Name" runat="server" text=<%$Request.QueryString['Text']%>></asp:TextBox>>
Run Code Online (Sandbox Code Playgroud)

但它不起作用

有人可以帮帮我吗?

c# asp.net sharepoint

10
推荐指数
3
解决办法
4万
查看次数

我可以避免这种linq查询冗余吗?

我的代码:

var myList = xDoc.Descendants("localita").Select(n => new
{
    ID = n.Element("id").Value.ToString(),
    Localita = n.Element("nome").Value.ToString(),
    Lat = n.Element("lat").Value.ToString(),
    Lng = n.Element("lon").Value.ToString(),
    MeteoOggi = new MeteoGiorno()
    {
        Min = n.Descendants("previsione").First().Element("temp_perc").Value.ToString(),
        Max = n.Descendants("previsione").First().Element("temp").Value.ToString(),
        DescrizioneTempo = n.Descendants("previsione").First().Element("desc_tempo").Value.ToString(),
        Precipitazioni = n.Descendants("previsione").First().Element("prec").Value.ToString(),
        VentoDirezione = n.Descendants("previsione").First().Element("v_dir").Value.ToString(),
        VentoIntensita = n.Descendants("previsione").First().Element("v_int").Value.ToString(),
        Pressione = n.Descendants("previsione").First().Element("press").Value.ToString(),
        ZeroTermico = n.Descendants("previsione").First().Element("zerot").Value.ToString(),
        Immagine = n.Descendants("previsione").First().Element("id_tempo").Value.ToString()
    }
});
Run Code Online (Sandbox Code Playgroud)

但正如您所看到的,n.Descendants("previsione").First()每次设置类的值时都会"搜索" MeteoGiorno.我可以在我的示例中对该节点进行一种引用吗?

.net c# linq linq-to-xml

2
推荐指数
1
解决办法
127
查看次数

标签 统计

c# ×2

.net ×1

asp.net ×1

linq ×1

linq-to-xml ×1

sharepoint ×1