- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我在调试我正在处理的网站时遇到“蓝屏死机”。错误信息是“value cannot be null. Parameter name: key.”我正在尝试将 formview 绑定(bind)到 gridview 的选定索引。当我在我的 selectedindexchanged 方法中设置断点时,一切似乎都正确绑定(bind),我可以查看我的 formview 的值,但是当我继续运行它时,我收到上述错误消息。我尝试将 datakeynames 属性添加到 formview 并得到相同的错误消息。我在这里和谷歌搜索并看到了一些结果,但似乎没有一个能解决或与我的问题相关。
部分代码如下:
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
lblMessage.Text = "";
cbCalled.Visible = true;
cbError.Visible = true;
cbVerbal.Visible = true;
btnSubmit.Visible = true;
FormView1.Visible = true;
FormView1.DataBind();
FormView fv1 = FormView1;
Label PathCountLabel = (Label)fv1.FindControl("pathcountLabel");
TextBox PathResult = (TextBox)fv1.FindControl("PathResultLabel");
if ((PathCountLabel.Text != "1 of 1 biopsies") && (PathCountLabel.Text != "Only 1 Pathology Ordered"))
{
PathResult.BackColor = ColorTranslator.FromHtml("#FFFFAA");
}
}
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
Visible="False" DataKeyNames="PatientID" DataSourceID="SqlDataSource1"
onselectedindexchanged="GridView1_SelectedIndexChanged" AllowSorting="True" onsorting="GridView1_Sorting">
<Columns>
<asp:CommandField ShowSelectButton="True" />
<asp:BoundField DataField="PatientID" HeaderText="Patient Id" SortExpression="PatientID" />
<asp:BoundField DataField="LastName" HeaderText="Last Name"
SortExpression="LastName" />
<asp:BoundField DataField="FirstName" HeaderText="First Name"
SortExpression="FirstName" />
<asp:BoundField DataField="PathCount" HeaderText="Path Count"
SortExpression="PathCount" />
<asp:BoundField DataField="DateOfService" DataFormatString="{0:d}"
HeaderText="Date of Service" SortExpression="DateOfService" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:PathologyConnectionString %>"
SelectCommand="SELECT * FROM [PatientDB]">
</asp:SqlDataSource>
<br />
</div>
<div id="rightCol">
<asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource2"
Width="708px">
<EditItemTemplate>
LastName:
<asp:TextBox ID="LastNameTextBox" runat="server"
Text='<%# Bind("LastName") %>' />
<br />
FirstName:
<asp:TextBox ID="FirstNameTextBox" runat="server"
Text='<%# Bind("FirstName") %>' />
<br />
DOB:
<asp:TextBox ID="DOBTextBox" runat="server"
Text='<%# Bind("DOB") %>' />
<br />
PhoneNumber:
<asp:TextBox ID="PhoneNumberTextBox" runat="server"
Text='<%# Bind("PhoneNumber") %>' />
<br />
ChartNumber:
<asp:TextBox ID="ChartNumberTextBox" runat="server"
Text='<%# Bind("ChartNumber") %>' />
<br />
AccountNumber:
<asp:TextBox ID="AccountNumberTextBox" runat="server"
Text='<%# Bind("AccountNumber") %>' />
<br />
PathResult:
<asp:TextBox ID="PathResultTextBox" runat="server"
Text='<%# Bind("PathResult") %>' />
<br />
PreviousVisitNote:
<asp:TextBox ID="PreviousVisitNoteTextBox" runat="server"
Text='<%# Bind("PreviousVisitNote") %>' />
<br />
PathSlipNote:
<asp:TextBox ID="PathSlipNoteTextBox" runat="server"
Text='<%# Bind("PathSlipNote") %>' />
<br />
PathSlipCheckboxes:
<asp:TextBox ID="PathSlipCheckboxesTextBox" runat="server"
Text='<%# Bind("PathSlipCheckboxes") %>' />
<br />
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True"
CommandName="Update" Text="Update" />
<asp:LinkButton ID="UpdateCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</EditItemTemplate>
<InsertItemTemplate>
LastName:
<asp:TextBox ID="LastNameTextBox" runat="server"
Text='<%# Bind("LastName") %>' />
<br />
FirstName:
<asp:TextBox ID="FirstNameTextBox" runat="server"
Text='<%# Bind("FirstName") %>' />
<br />
DOB:
<asp:TextBox ID="DOBTextBox" runat="server"
Text='<%# Bind("DOB") %>' />
<br />
PhoneNumber:
<asp:TextBox ID="PhoneNumberTextBox" runat="server"
Text='<%# Bind("PhoneNumber") %>' />
<br />
ChartNumber:
<asp:TextBox ID="ChartNumberTextBox" runat="server"
Text='<%# Bind("ChartNumber") %>' />
<br />
AccountNumber:
<asp:TextBox ID="AccountNumberTextBox" runat="server"
Text='<%# Bind("AccountNumber") %>' />
<br />
PathResult:
<asp:TextBox ID="PathResultTextBox" runat="server"
Text='<%# Bind("PathResult") %>' />
<br />
PreviousVisitNote:
<asp:TextBox ID="PreviousVisitNoteTextBox" runat="server"
Text='<%# Bind("PreviousVisitNote") %>' />
<br />
PathSlipNote:
<asp:TextBox ID="PathSlipNoteTextBox" runat="server"
Text='<%# Bind("PathSlipNote") %>' />
<br />
PathSlipCheckboxes:
<asp:TextBox ID="PathSlipCheckboxesTextBox" runat="server"
Text='<%# Bind("PathSlipCheckboxes") %>' />
<br />
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True"
CommandName="Insert" Text="Insert" />
<asp:LinkButton ID="InsertCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</InsertItemTemplate>
<ItemTemplate>
Last Name:
<asp:Label ID="LastNameLabel" runat="server" Text='<%# Bind("LastName") %>' />
First Name:
<asp:Label ID="FirstNameLabel" runat="server" Text='<%# Bind("FirstName") %>' />
DOB:
<asp:Label ID="DOBLabel" runat="server" Text='<%# Bind("DOB") %>' />
<br />
<br />
Phone Number:
<asp:Label ID="PhoneNumberLabel" runat="server"
Text='<%# Bind("PhoneNumber") %>' />
Chart Number:
<asp:Label ID="ChartNumberLabel" runat="server"
Text='<%# Bind("ChartNumber") %>' />
Account Number:
<asp:Label ID="AccountNumberLabel" runat="server"
Text='<%# Bind("AccountNumber") %>' />
<br />
<br />
Biopsy Location:
<asp:Label ID="BiopsyLocationLabel" runat="server" Text='<%# Bind("BiopsyArea") %>'></asp:Label>
<br />
<br />
Path Result:
<br />
<asp:TextBox ID="PathResultLabel" runat="server"
Text='<%# Bind("PathResult") %>' ReadOnly="True" TextMode="MultiLine" Width="600" Height="250" />
<br />
<br />
Previous Visit Note:<br />
<asp:TextBox ID="PreviousVisitNoteLabel" runat="server"
Text='<%# Bind("PreviousVisitNote") %>' ReadOnly="True" TextMode="MultiLine" Width="600" Height="250" />
<br />
<br />
Pathology Lab Note:<br />
<asp:TextBox ID="txtPathNote" runat="server"
Text='<%# Bind("PathNote") %>' ReadOnly="True" TextMode="MultiLine" Width="600" Height="150" />
<br />
<br />
Note to DA/DT:<br />
<asp:TextBox ID="txtDADTNote" runat="server"
Text='<%# Bind("DADTNote") %>' ReadOnly="True" TextMode="MultiLine" Width="600" Height="150" />
<br />
<br />
Path Slip Note:<br />
<asp:Label ID="PathSlipNoteLabel" runat="server"
Text='<%# Bind("PathSlipNote") %>' />
<br />
<br />
Path Slip Checkboxes:
<br />
<asp:Label ID="PathSlipCheckboxesLabel" runat="server"
Text='<%# Bind("PathSlipCheckboxes") %>' />
<br />
<br />
Patient Message:<br />
<ASPNetSpell:SpellTextBox ID="txtPatientMessage" runat="server" TextMode="MultiLine"
DictionaryLanguage="English (International), English (Medical)" Height="88px"
Width="597px" Text='<%# Bind("PatientMessage") %>' onKeyPress="return macro(event);"></ASPNetSpell:SpellTextBox>
<br />
<asp:Label ID="pathcountLabel" runat="server" Text = '<%# Bind("PathCount") %>' Visible="false"></asp:Label>
</ItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:PathologyConnectionString %>"
SelectCommand="SELECT [LastName], [FirstName], [DOB], [PhoneNumber], [ChartNumber], [AccountNumber], [PathResult], [PreviousVisitNote], [PathSlipNote], [PathSlipCheckboxes], [PathNote], [DADTNote], [BiopsyArea], [PatientMessage], [PathCount] FROM [PatientDB] WHERE ([PatientID] = @PatientID)">
<SelectParameters>
<asp:ControlParameter ControlID="GridView1" Name="PatientID"
PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
我添加了来自 YSOD 的堆栈跟踪
Server Error in '/' Application.
--------------------------------------------------------------------------------
Value cannot be null.
Parameter name: key
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: key
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentNullException: Value cannot be null.
Parameter name: key]
System.Collections.Generic.Dictionary`2.FindEntry(TKey key) +10627293
System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value) +12
Microsoft.VisualStudio.Web.PageInspector.Runtime.WebForms.SelectionMappingRenderTraceListener.GetLiteralTraceData(LiteralControl literal, TraceData& data) +97
Microsoft.VisualStudio.Web.PageInspector.Runtime.WebForms.SelectionMappingRenderTraceListener.GetTraceData(Object renderedObject) +421
Microsoft.VisualStudio.Web.PageInspector.Runtime.WebForms.SelectionMappingRenderTraceListener.EndRendering(TextWriter writer, Object renderedObject) +79
System.Web.UI.RenderTraceListenerList.EndRendering(TextWriter writer, Object renderedObject) +58
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +142
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
ASPNetSpell.SpellTextBox.Render(HtmlTextWriter writer) +6035
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.WebControls.TableCell.RenderContents(HtmlTextWriter writer) +57
System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +32
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.WebControls.WebControl.RenderContents(HtmlTextWriter writer) +10
System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +32
System.Web.UI.WebControls.FormViewRow.Render(HtmlTextWriter writer) +38
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.WebControls.Table.RenderContents(HtmlTextWriter writer) +211
System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +32
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.WebControls.WebControl.RenderContents(HtmlTextWriter writer) +10
System.Web.UI.WebControls.FormView.Render(HtmlTextWriter writer) +86
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Control.Render(HtmlTextWriter writer) +10
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +102
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32
System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +53
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +40
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Control.Render(HtmlTextWriter writer) +10
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Page.Render(HtmlTextWriter writer) +29
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1386
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18446
最佳答案
你说的我都试过了,还是不行。但是,我发现了一个解决方法,不知为何,它起作用了。我将此添加到我的 web.config 文件中:
<add key="PageInspector:ServerCodeMappingSupport" value="Disabled" />
它对我有用:D
关于c# - "value cannot be null parameter name: key",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22871284/
最近开始学习oracle和sql。 在学习的过程中,我遇到了几个问题,我的 friend 在接受采访时被问到这些问题。 SELECT * FROM Employees WHERE NULL IS N
这个问题在这里已经有了答案: Can we subtract NULL pointers? (4 个回答) 关闭 2 个月前。 是否定义了NULL - NULL? (char *)NULL - (ch
是否有推荐的方法(根据 .net Framework 指南)检查 null,例如: if (value == null) {//code1} else {//code2} 或 if (value !=
我正在尝试将值插入数据库,但出现这样的错误任何人都可以告诉我为什么该值为空,如下所示: An exception occurred while executing 'INSERT INTO perso
这个问题在这里已经有了答案: String concatenation with a null seems to nullify the entire string - is that desire
您好,我正在 Android 联系人搜索模块中工作。我正在查询下方运行。 cur = context.getContentResolver().query(ContactsContract.Data.
下面的 SQL 表定义说明了从我的 MYSQL 数据库创建表的语句之一,该数据库是由我公司的前开发人员开发的。 DROP TABLE IF EXISTS `classifieds`.`category
我主要有应用程序开发背景。在编程语言中 variable == null或 variable != null有效。 当涉及到 SQL 时,以下查询不会给出任何语法错误,但也不会返回正确的结果。 sel
我在尝试检查某些元素是否为 NULL 时遇到段错误或不。任何人都可以帮忙吗? void addEdge(int i, int j) { if (i >= 0 && j > 0)
在 SQL 服务器中考虑到以下事实:Col1 和 Col2 包含数值和 NULL 值 SELECT COALESCE(Col1,Col2) 返回一个错误:“COALESCE 的至少一个参数必须是一个不
在 SQL 服务器中考虑到以下事实:Col1 和 Col2 包含数值和 NULL 值 SELECT COALESCE(Col1,Col2) 返回一个错误:“COALESCE 的至少一个参数必须是一个不
下面查询的关系代数表达式是什么?我找不到“Is Null”的表达式。 SELECT reader.name FROM reader LEFT JOIN book_borrow ON reader.ca
我正在尝试使用三元运算符来检查值是否为 null 并返回一个表达式或另一个。将此合并到 LINQ 表达式时,我遇到的是 LINQ 表达式的 Transact-SQL 转换试图执行“column = n
我在给定的代码中看到了以下行: select(0, (fd_set *) NULL, (fd_set *) NULL, (fd_set *) NULL, &timeout); http://linux
var re = /null/g; re.test('null null'); //> true re.test('null null'); //> true re.test('null null')
这个问题在这里已经有了答案: 关闭 13 年前。 我今天避开了一场关于数据库中空值的激烈辩论。 我的观点是 null 是未指定值的极好指示符。团队中有意见的其他每个人都认为零和空字符串是可行的方法。
由于此错误,我无法在模拟器中运行我的应用: Error:null value in entry: streamOutputFolder=null 或 gradle - Error:null value
我正在尝试在 Android 应用程序中创建电影数据库,但它返回错误。知道这意味着什么吗? public Cursor returnData() { return db.query(TABLE
我一直在检查浏览器中的日期函数以及运行时间 new Date (null, null, null); 在开发工具控制台中,它给出了有效的日期 Chrome v 61 回归 Sun Dec 31 189
为什么 NA==NULL 会导致 logical (0) 而不是 FALSE? 为什么 NULL==NULL 会导致 logical(0) 而不是 TRUE? 最佳答案 NULL 是一个“零长度”对象
我是一名优秀的程序员,十分优秀!