在我的页面中,我有两个用户控件
现在,StatusupdateArea.ascx负责显示帖子,因此我将继续 Telerik的Listview控件。
现在,我在Google上搜索并找到了一篇文章,该文章展示了这种方法,
public partial class StatusUpdateArea : UserControl
{
private readonly LanguageConvertion lc = new LanguageConvertion();
private readonly BEL_UserAccount obj_BEL_UserAccount = new BEL_UserAccount();
private readonly BL_UserAccount obj_BL_UserAccount = new BL_UserAccount();
string _imageUrl = "";
public RadListView ListViewStatus => rlv_StatusPost; // responsible for displaying posts...
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="StatusPostingArea.ascx.cs" Inherits="e2aPortal.homeUserControl.StatusPostingArea" %>
<%@ Reference VirtualPath="~/homeUserControl/StatusUpdateArea.ascx" %>
当用户单击“发布”按钮时,
protected void btn_PostSubmit_Click(object sender, EventArgs e)
{
radwndw_insertQuestion.VisibleOnPageLoad = false;
var errormessage = string.Empty;
obj_BEL_UserAccount.strStatusText = Convert.ToString(txt_status_message.Value);
obj_BEL_UserAccount.strLangCulture = lc.DetectLanguage(txt_status_message.Value);
obj_BEL_UserAccount.strUserId = Convert.ToString(Request.Cookies["_userid"].Value);
var i = obj_BL_UserAccount.InsertStatusPost(obj_BEL_UserAccount, out errormessage);
if (i <= 0)
{
Toastr.Toastr.ShowToast(this.Page,Toastr.Toastr.ToastType.Error, "Error posting!","Error",Toastr.Toastr.ToastPosition.TopRight);
}
//((StatusUpdateArea)Page.FindControl("StatusUpdateArea")).ListViewStatus.Rebind(); // throwing Null reference exception ..StatusUpdateArea is NULL..
// StatusUpdateArea-> ID of that user control
}
有什么办法解决这个问题吗?或者还有其他方法可以使用吗?预先感谢