如何在usercontrol中编写代码以从sql表获取数据并在aspx.cs页中调用它? [英] how to write code in usercontrol to get data from sql table and call it in aspx.cs page?
本文介绍了如何在usercontrol中编写代码以从sql表获取数据并在aspx.cs页中调用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hi如何在选择垂直记录进行编辑时如何在用户控件中创建函数或类以从sql表中获取值.
首先,我想在usercontrol中编写类
然后我想在aspx.cs页面中调用该类.
在我的项目中DID和DocType很常见..所以我想使用DID和DocType获取记录
请给我建议.
谢谢.
hi how to create a function or class to get values from sql table in usercontrol while selecting perticular records to edit.
first i want to write class in usercontrol
and then i want to call that class in aspx.cs page.
in my project DID and DocType is common..so i want to get records using DID and DocType
please suggest me..
thank you.
推荐答案
创建用户控件,然后创建一个函数,该函数从sql表加载数据,然后使用
从父.aspx.cs文件调用此函数.
使用:使用System.Reflection;
方法调用代码:
MethodInfo mi = UserControl1.GetType().GetMethod("UserControlFunction");
mi.Invoke(UserControl1,null);
Create user control then create a function which load data from sql table then invoke this function from parent .aspx.cs file using
using: using System.Reflection;
Method invoke code:
MethodInfo mi = UserControl1.GetType().GetMethod("UserControlFunction");
mi.Invoke(UserControl1, null);
这篇关于如何在usercontrol中编写代码以从sql表获取数据并在aspx.cs页中调用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文