进行自动后备控制值会丢失 [英] Making autopostback the control values are lost

查看:68
本文介绍了进行自动后备控制值会丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好

我正在vs2015开发一个网站。在一个表单中我有几个下拉列表,选择它们的值会更改表单中的其他值。

问题是当用户登录时这很好用,但是当它不是时,通过制作autopostback控制值丢失。

知道为什么会这样吗?

谢谢



我尝试了什么:



我使用的代码只在加载中运行一次因为我已经放置了条件

Hello
I am developing a website in vs2015. In a form I have several dropdownlist that selecting a value on them change other values in the form.
the problem is that this works well when the user is logged in, but when it is not, by making autopostback the control values are lost.
Any idea why this happens?
Thank you

What I have tried:

the code that I use is only in the load and runs once because I have put conditional

if (!IsPostBack)
            {
}



和dropdownlist控件由ObjectDataSource填充


and dropdownlist controls are filled by ObjectDataSource

推荐答案

你可以使用Ajax





@using(Ajax.BeginForm(方法名称,控制器名称,

新AjaxOptions {UpdateTargetId =ur Div Id}))
You can Use Ajax


@using (Ajax.BeginForm("Method Name", "Controller Name",
new AjaxOptions { UpdateTargetId = "ur Div Id" }))


这篇关于进行自动后备控制值会丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆