简体   繁体   English

如何通过外部页面链接到ASP:DetailsView的插入模式

[英]How do I link to an ASP:DetailsView's Insert mode via an external page

Unlike many of the ASP.NET documentation and examples, I'm doing a gridview list on one page, and it links to a 2nd page to do the edit/update view, sending the ID for the record in the GET string. 与许多ASP.NET文档和示例不同,我在一个页面上执行gridview列表,它链接到第二页以执行编辑/更新视图,在GET字符串中发送记录的ID。

On my edit/update view, I'm using an ASP:DetailsView for viewing, editing and inserting records. 在我的编辑/更新视图中,我使用ASP:DetailsView来查看,编辑和插入记录。 All of this works fine. 所有这一切都很好。

On the detailsView page, I have it autogenerating a new record link that uses postback to show the blank insert form to be filled out. detailsView页面上,我让它自动生成一个new record链接,该链接使用回发来显示要填写的空白插入表单。

The only problem is, I have no idea how to link to the insert view of the DetailsView from an external page. 唯一的问题是,我不知道如何从外部页面链接到DetailsViewinsert视图。 Am I missing something? 我错过了什么吗?

I could have misunderstood your question but.... 我本可以误解你的问题,但....

I don't believe you can 'link to the insert view', but what you can do is programmatically change the mode of the DetailsView once the page has loaded. 我不相信你可以“链接到插入视图”,但你可以做的是在页面加载后以编程方式更改DetailsView的模式。 Remember to check that the passed in ID has a value first. 请记住检查传入的ID是否具有值。

For example: 例如:

If Not idValue Is Nothing Then   
    yourDetailsViewName.ChangeMode(DetailsViewMode.Insert)
End If

Check out the MSDN page for more info: 查看MSDN页面了解更多信息:
DetailsView.ChangeMode Method DetailsView.ChangeMode方法

I just wanted to follow up and say that, even though I did not find a way to link to a specific page state, I did discover the dataview's DefaultMode parameter, that at least allows you to pick an initial state. 我只是想跟进并说,即使我没有找到链接到特定页面状态的方法,我确实发现了dataview的DefaultMode参数,至少可以让你选择一个初始状态。

Thus: DefaultMode="Insert" 因此:DefaultMode =“Insert”

At least lets you choose insert mode as the default. 至少允许您选择插入模式作为默认值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何为DetailsView的“插入”和“取消”按钮分配不同的样式? - How do I assign different style to Insert and Cancel buttons of a DetailsView? 处于DetailsView插入模式的验证器 - Validators in DetailsView insert mode 如何在IE6的编辑模式下使DetailsView CheckBoxField可见? - How do I make a DetailsView CheckBoxField visible in edit mode in IE6? 如何更新asp:detailsview - How to update asp:detailsview ASP.NET:如何创建单选按钮并将其数据绑定到DetailsView中? - ASP.NET: How do I create radio buttons and databind them in a DetailsView? ASP.NET DetailsView更改字段显示的编辑诗句插入模式 - ASP.NET DetailsView changing field display for edit verses insert mode 从DetailsView插入模式将图像上传到数据库 - Upload Image to Database From DetailsView Insert Mode 在ASP.NET中,如何找到嵌套在DetailsView中然后嵌套在AJAX UpdatePanel控件中的TextBox的控件ID? - In ASP.NET how do I find the Control ID of a TextBox that is nested within a DetailsView which is then nested in an AJAX UpdatePanel control? ASP.NET:如何打开我具有其登录凭据的外部网站页面? - ASP.NET: How do I open an external website page whose login credentials I have? 单击插入时,DetailsView Web控件不会更改为插入模式 - DetailsView web control does not change to insert mode when insert is clicked
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM