My webpart is programmed with C# and shall show a form and a checkbox. If the user click on it the OnCheckedChanged-Event must trigger (I think so). But the webpart send the dates not at this time to server. With <asp:checkbox ... AutoPostBack = "true" ... />
it works. The problem is that the other form fields are thereby extinguished/reset and I don´t want cache the data. What can I do? It is reasonable evaluate the checkbox on client-site? Or can I trigger the OnCheckedChanged-Event by an other way? thanks.
我的webpart使用C#编程,并显示一个表单和一个复选框。如果用户点击它,OnCheckedChanged-Event必须触发(我想是这样)。但是webpart会将此时的日期发送给服务器。使用
1 个解决方案
#1
1
I think this is occurring because of postback . You must check the Ispostback property on page load in order to avoid this type of issues. Also this helps you to prevent unwanted function calls when you do postback. Also check the function you are calling in page load.
我认为这是因为回发而发生的。您必须在页面加载时检查Ispostback属性,以避免此类问题。此外,这有助于您在进行回发时防止不需要的函数调用。还要检查您在页面加载中调用的功能。
Also there is a chance that you may set ViewState="false"
in html part. So that the controls doesn't have any value after the postback. Make sure that you are enabling the ViewState for your controls.
您也有可能在html部分中设置ViewState =“false”。这样控件在回发后没有任何值。确保为控件启用ViewState。
Just have a look at these urls. or paste you html as well as Code in Page Load event .
看看这些网址吧。或粘贴你的html以及页面加载事件中的代码。
Kindly provide some more details.
请提供更多细节。
#1
1
I think this is occurring because of postback . You must check the Ispostback property on page load in order to avoid this type of issues. Also this helps you to prevent unwanted function calls when you do postback. Also check the function you are calling in page load.
我认为这是因为回发而发生的。您必须在页面加载时检查Ispostback属性,以避免此类问题。此外,这有助于您在进行回发时防止不需要的函数调用。还要检查您在页面加载中调用的功能。
Also there is a chance that you may set ViewState="false"
in html part. So that the controls doesn't have any value after the postback. Make sure that you are enabling the ViewState for your controls.
您也有可能在html部分中设置ViewState =“false”。这样控件在回发后没有任何值。确保为控件启用ViewState。
Just have a look at these urls. or paste you html as well as Code in Page Load event .
看看这些网址吧。或粘贴你的html以及页面加载事件中的代码。
Kindly provide some more details.
请提供更多细节。