zoukankan
html css js c++ java
动态加载控件疑惑。。。。
这是在页面的代码:
1
string
IDX
=
""
;
IDX
=
Request.QueryString[
"
IDX
"
];
c_EditItem
=
(EditItem)Page.LoadControl(
"
ProductBarcodeControls/EditItem.ascx
"
);
c_EditItem.PK_ID
=
IDX;
this
.Web_contaner.Controls.Add(c_EditItem);
c_EditItem.setRunningType(ActionType.UpdatedBarcodeItem);
这里是用户控件中runingType的代码
2
public
void
setRunningType(
string
rtype)
{
switch
(rtype)
{
case
ActionType.UpdatedBarcodeItem:
SetLableToText();
code_txt.EditEnable
=
false
;
Action_pal.Visible
=
true
;
add_btn.Visible
=
false
;
this
.BindList();
break
;
case
ActionType.ViewBarcodeItem:
Action_pal.Visible
=
false
;
this
.BindList();
break
;
}
}
这里是梆定数据的代码
3
DataRow Row
=
this
.myCode.getBarcodeByIDX(
this
.PK_ID);
code_txt.Text
=
Row[BarcodeData.Code_FIELD].ToString();
partNo_txt.Text
=
Row[BarcodeData.PartNo_FIELD].ToString();
UpdatePartNO_txt.Text
=
Row[BarcodeData.NewPartNo_FIELD].ToString();
StandardPartNO_txt.Text
=
Row[BarcodeData.StandPartNO_FIELD].ToString();
Customer_txt.Text
=
Row[BarcodeData.Customer_FIELD].ToString();
status_rdb.SelectedValue
=
Row[BarcodeData.Status_FIELD].ToString().Trim().ToLower();
remark_txt.Text
=
Row[BarcodeData.Remark_FIELD].ToString();
LabelType_txt.Text
=
Row[BarcodeData.LabelType_FIELD].ToString();
LableDescritiop_txt.Text
=
Row[BarcodeData.LabelDescription_FIELD].ToString();
Description_txt.Text
=
Row[BarcodeData.Description_FIELD].ToString();
UpdateDesc_txt.Text
=
Row[BarcodeData.NewDescription_FIELD].ToString();
这里是按下update后更新的代码
4
DataRow Row
=
this
.myCode.getBarcodeByIDX(
this
.PK_ID);
Row[BarcodeData.PartNo_FIELD]
=
partNo_txt.Text.Trim();
Row[BarcodeData.NewPartNo_FIELD]
=
UpdatePartNO_txt.Text.Trim();
Row[BarcodeData.StandPartNO_FIELD]
=
StandardPartNO_txt.Text.Trim();
Row[BarcodeData.Customer_FIELD]
=
Customer_txt.Text.Trim();
Row[BarcodeData.Status_FIELD]
=
status_rdb.SelectedValue;
Row[BarcodeData.Remark_FIELD]
=
remark_txt.Text.Trim();
Row[BarcodeData.LabelType_FIELD]
=
LabelType_txt.Text.Trim();
Row[BarcodeData.LabelDescription_FIELD]
=
LableDescritiop_txt.Text.Trim();
Row[BarcodeData.Description_FIELD]
=
Description_txt.Text.Trim();
Row[BarcodeData.NewDescription_FIELD]
=
UpdateDesc_txt.Text.Trim();
Row[BarcodeData.LastModify_FIELD]
=
System.DateTime.Now;
Row.AcceptChanges();
我点击update按钮更新数据的顺序通过跟踪是
1-2-3-4
这里有个逻辑错误:
即 第3步不该执行。
按照我的想法,
数据不会被更新,因为在3步的时候重新绑定了数据。
可是结果相反,数据得到更新。
正常的逻辑应该是
1-2-4
虽然我不知道微软怎么样处理的,我按照正确的逻辑重写了2步
case
ActionType.UpdatedBarcodeItem:
SetLableToText();
code_txt.EditEnable
=
false
;
Action_pal.Visible
=
true
;
add_btn.Visible
=
false
;
if
(
!
IsPostBack)
this
.BindList();
break
;
表示在post时候,不在page load的时候重新绑定数据
查看全文
相关阅读:
android 项目学习随笔十五(ShareSDK开放平台)
android 项目学习随笔十四(WebView)
android 项目学习随笔十三(ListView实现ITEM点击事件,将已读状态持久化到本地)
android 项目学习随笔十二(ListView加脚布局)
android 项目学习随笔十一(ListView下拉刷新提示)
android 项目学习随笔十(自定义ProgressBar)
android 项目学习随笔九(ListView加头布局)
android 项目学习随笔八(xUtils的BitmapUtils模块)
android 项目学习随笔七(ViewPagerIndicator与ViewPager)
android 项目学习随笔六(网络缓存)
原文地址:https://www.cnblogs.com/king_astar/p/91736.html
最新文章
Docker从0开始之部署一套2048小游戏
centos 检测aufs 并安装
Centos 6 安装Docker
用Go的风格实现素数筛选
工作流程管理软件的架构与功能
android textView 添加超链接(两种实现方式)
android 开发(百度地图)
android 开发工具(android studio)
android 应用架构随笔六(Loading加载页面)
android 应用架构随笔五(ActionBar与侧滑菜单DrawerLayout)
热门文章
android 应用架构随笔四(View、ViewGroup)
android 应用架构随笔三(ListView)
android 应用架构随笔二(定义BaseApplication并配置Application)
android 应用架构随笔一(架构搭建)
android 项目学习随笔二十一(IM、语音识别、机器人、统计、扫描二维码、条形码)
android 项目学习随笔二十(屏幕适配)
android 项目学习随笔十九(MD5)
android 项目学习随笔十八(三级缓存)
android 项目学习随笔十七(ListView、GridView显示组图)
android 项目学习随笔十六( 广告轮播条播放)
Copyright © 2011-2022 走看看