小编Sri*_*vas的帖子

如何从MVC4中的web.config获取String值

我想获得一个logFilePath值,我将硬编码提供给appSettings.我试图达到关键价值

System.Configuration.Configuration rootWebConfig1 = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(null);
System.Configuration.KeyValueConfigurationElement customSetting = rootWebConfig1.AppSettings.Settings["azureLogUrl"];
string pathValue =  customSetting.Value;
Run Code Online (Sandbox Code Playgroud)

但我得到null引用异常.如何从web.config文件中获取值?

c# asp.net-mvc azure asp.net-mvc-4

16
推荐指数
2
解决办法
5万
查看次数

动态调整表格单元格宽度

我正在动态地将行和列添加到表格中,但我无法调整第一列的宽度。 . 它总是显示该列中数据的列宽到长度,但我希望它被修复。请问这里有什么问题。

TableRow tr = new TableRow(); 
TableCell tc = new TableCell(); 
tc = new TableCell(); 
tc.ID = "tcResource"; 
tc.Text = "Resource_Name"; 
Unit uWidth = new Unit(300, UnitType.Point); 
tc.Width = uWidth; 
tr.Cells.Add(tc); 
for (i = 1; i <= 365; i++) 
{ 
  tc = new TableCell(); 
  tc.ID = "tc" + i.ToString(); 
  tc.Text = dtStart.AddDays(i).ToString("dd/MM") ; 
  dtRange[i - 1] = dtStart.AddDays(i ); 
  tr.Cells.Add(tc); 
} 
tHoliday.Rows.Add(tr); 
Run Code Online (Sandbox Code Playgroud)

c# asp.net

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

foreach功能的进度条不起作用

我正在设计的程序通过获取图像的文件名来生成图像,在cdb中搜索该名称,然后使用该数据库项中的数据生成图片.所有这些都有效.我现在想要做的是添加一个进度条,因为如果你正在做大量的图片,它可能需要一段时间,所以进度条将有助于跟踪它.这是我正在使用的代码,但进度条中的进度不会提前,直到最后我想避免使用后台工作程序(如果我可以).

   private void button5_Click(object sender, EventArgs e)
    {
        if (folderBrowserDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
        {
            string folder = folderBrowserDialog1.SelectedPath;
            DirectoryInfo dinfo = new DirectoryInfo(folderBrowserDialog1.SelectedPath);
            FileInfo[] Files = dinfo.GetFiles("*.jpg");
            int count = Files.Length;
            int current = 0;
            foreach (FileInfo file in Files)
            {
                string path = Path.GetFileNameWithoutExtension(file.Name);
                int cardid = Convert.ToInt32(path);
                if (Program.CardData.ContainsKey(cardid))
                {
                    DevPro_CardManager.cardmaker.IMG = LoadBitmap(folderBrowserDialog1.SelectedPath + "//" + file.Name);
                    string lev = Program.CardData[cardid].Level.ToString();
                    comboBox2.SelectedItem = lev;
                    string att = Program.CardData[cardid].Attribute.ToString();
                    if (att == "1")
                    {
                        att = "earth";
                    }
                    else if …
Run Code Online (Sandbox Code Playgroud)

c# foreach progress-bar

0
推荐指数
1
解决办法
1925
查看次数

标签 统计

c# ×3

asp.net ×1

asp.net-mvc ×1

asp.net-mvc-4 ×1

azure ×1

foreach ×1

progress-bar ×1