我试图让我的gridview更新一个SQL记录,但它没有更新值.
这是aspx代码:
<asp:GridView ID="GridView1" runat="server" GridLines="None" AutoGenerateColumns="false"
onrowcancelingedit="GridView1_RowCancelling"
OnRowDeleting ="GridView1_RowDeleting"
onrowediting="GridView1_RowEditing"
onrowupdating="GridView1_RowUpdating"
DataKeyNames="RID"
CssClass="mGrid"
PagerStyle-CssClass="pgr"
AlternatingRowStyle-CssClass="alt">
<Columns>
<asp:TemplateField Visible="false" HeaderText="RID">
<ItemTemplate>
<asp:Label runat="server" ID="RID" Text='<%#Bind("RID")%>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Short Description">
<ItemTemplate>
<asp:Label runat="server" ID="short_lbl" Text='<%#Bind("SHORT_DESCRIPTION") %>' />
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" ID="SHORT_DESCRIPTION" Text='<%#Bind("SHORT_DESCRIPTION") %>' />
<asp:RequiredFieldValidator runat="server" ID="valShort" ControlToValidate="SHORT_DESCRIPTION" ValidationGroup="var1" ErrorMessage="*" />
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Description">
<ItemTemplate>
<asp:Label runat="server" ID="desc_label" Text='<%#Bind("DESCRIPTION") %>' />
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" ID="DESCRIPTION" Text='<%#Bind("DESCRIPTION") %>' />
<asp:RequiredFieldValidator runat="server" ID="valLast" ControlToValidate="DESCRIPTION" ValidationGroup="var1" ErrorMessage="*" />
</EditItemTemplate> …Run Code Online (Sandbox Code Playgroud) 我是一个动作新手所以我希望我在这里缺少一些简单的东西.简而言之,我有一个for循环更新动态文本元素,但似乎迭代速度太快,只有循环中的最后一项更新文本.我希望动态文本元素用循环中的EACH项更新,而不仅仅是最后一项.
我有一个单帧电影,我从外部文本文件创建一个简单的字符串数组:
_global.i = 0;
_global.numplaces = 0;
_global.PlacesArray = new Array();
loadedText = new LoadVars();
loadedText.onLoad = function() {
filecontents = this.places;
_global.PlacesArray = filecontents.split(";"); //parse the file string
_global.numplaces = _global.PlacesArray.length-1;
};
loadedText.load("listofplaces.txt");
Run Code Online (Sandbox Code Playgroud)
在嵌套电影("places")中,我有一个for循环:
for (_global.i=0; _global.i<_global.numplaces; _global.i++) {
trace("global i is "+_global.i);
trace(_global.PlacesArray[_global.i]);
CityState.place.htmlText = _global.PlacesArray[_global.i];
}
Run Code Online (Sandbox Code Playgroud)
跟踪工作正常,并显示for循环正在迭代.但是,place.htmlText电影中的动态文本嵌套了一个级别(用于补间目的),我希望循环更新只是使用数组中的最后一项进行更新.
在编写C#代码时,如果我可以设法获得SqlConnection,有没有办法执行查询来获取数据库的大小?
我搜索了互联网,似乎可以使用"sp_spaceused",但它不是一个表,它是一个程序.
我可以查询程序吗?
我已经声明了我的泛型函数如下
public static Dictionary<TZerokey, Dictionary<TFirstKey, Dictionary<TSecondKey, TValue>>>
PivotCountry<TSource,TZeroKey, TFirstKey, TSecondKey, TValue>
(this IEnumerable<TSource> source,Func<TSource,TZeroKey> zerokeySelector,
Func<TSource, TFirstKey> firstKeySelector,
Func<TSource, TSecondKey> secondKeySelector,
Func<IEnumerable<TSource>, TValue> aggregate)
{
return null;//return value is not important for my question
}
Run Code Online (Sandbox Code Playgroud)
我收到编译错误
无法找到TZerokey.您是否缺少using指令或程序集引用?
有人能告诉我我的申报有什么问题吗?
提前致谢
我看不到任何图片.为什么?
UIImage *photoImg = [UIImage imageNamed:@"http://blog.leadcritic.com/wp-content/uploads/2011/02/favorite_animal_picture.jpg"];
UIImageView *imageView2 = [[UIImageView alloc] initWithImage:photoImg];
[self.view addSubview:imageView2];
Run Code Online (Sandbox Code Playgroud) 我想使用相同的局部视图来显示记录和编辑记录.两个函数的布局都是相同的,它看起来比拥有EditRecord局部视图和DisplayRecord局部视图要清晰得多.如果我只有一个部分视图要更新,维护将更容易.
我现在正在使用它并且它有效:
<div class="editor-label">
@Html.LabelFor(model => model.FirstName)
</div>
<div class="editor-field">
@if (@ViewBag.ViewMode == "display")
{
@Html.DisplayFor(model => model.FirstName)
}
else
{
@Html.EditorFor(model => model.FirstName)
}
@Html.ValidationMessageFor(model => model.FirstName)
</div>
Run Code Online (Sandbox Code Playgroud)
有没有更好的方法呢?
谢谢.
private void button3_Click_1(object sender, EventArgs e)
{
textBox2.Text = "$" + (textBox1.Text = string.Format(System.Globalization.CultureInfo.GetCultureInfo("us-US"), "{0:#,##0.00}", double.Parse(textBox1.Text)));
string digits, temp;
long numberVal;
string[] powers = new string[] { "Thousand ", "Million " };
string[] ones = new string[] { "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen" };
string[] tens = new string[] { "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety" };
string[] currency = new string[] { "Dollars" …Run Code Online (Sandbox Code Playgroud) 如果在程序关闭之前有办法执行某个操作,我就会徘徊.我正在运行一个程序很长一段时间,我确实希望能够关闭它并将数据保存在文本文件或其他东西中,但是我没有办法干扰while True我运行的循环,只是保存每个循环的数据都非常无效.
那么有什么方法可以保存数据,比如列表,当我点击x或销毁程序时?我一直在看atexit模块,但没有运气,除非我设置程序在某一点完成.
def saveFile(list):
print "Saving List"
with open("file.txt", "a") as test_file:
test_file.write(str(list[-1]))
atexit.register(saveFile(list))
Run Code Online (Sandbox Code Playgroud)
这是我整个atexit代码的部分,就像我说的那样,当我将它设置为关闭时,它运行正常while loop.
这是可能的,在应用程序终止时保存一些东西吗?
我有一个自定义TableviewCell Interfacebuilder,这是它的样子IB:

注意标签下面的细白线.这是它在运行时期间应该看起来的样子.
层次结构UITableViewCell:

我的问题是,在应用程序的运行时,线(这是第一个View下面的View)比例太大,我认为大约5px高度,甚至可能更大.
经过一些研究后我尝试了以下内容,但它不起作用.
cell.line.frame =CGRectMake(161,36,282,1/[[UIScreen mainScreen] scale]);
Run Code Online (Sandbox Code Playgroud) 我创建2个变量的名称与一个和b然后我初始化变量一个有值"开始",后来我给你变一个变量b,最后我改变变量的值,一到年底,但变量b不改变,而一个和b是参考类型!
string a = "start"; // Declare and initialize a variable
string b = a; // Copy the variable's value to a new variable
a = "end"; // Modify the value of the original variable
//variable b don't change!!
Run Code Online (Sandbox Code Playgroud)
为什么这不按预期工作?
c# ×6
.net ×2
asp.net ×2
string ×2
asp.net-mvc ×1
dictionary ×1
flash ×1
generics ×1
gridview ×1
ios ×1
iphone ×1
objective-c ×1
python ×1
reference ×1
return ×1
sql-server ×1
t-sql ×1
terminate ×1
textbox ×1
uiimage ×1
uiimageview ×1