ساخت DataGrid در زمان اجرا و Bind کردن آن
با سلام
من در پروژم در زمان اجرا یه رشته به نام str تولید کردم که حاوی کدهای html برای ساخت یه گریده.
و در زمان اجرا این دستور رو میدم:
(response.write(str
فرم بدرستی کار میکنه و دیتا گرید رو میسازه
مشکلی که دارم اینه که در زمان اجرا بعد از تولید دیتا گرید میخوام دیتاسورسش رو مشخص کنم و اونو بایند کنم ولی مطمئنا این اجازه رو ندارم چون در زمان طراحی هنوز گریدی وجود نداره.
برای اینکار اومدم این دستورات رو دادم :
dim dg as new datagrid
(ctype(dg=me.findcontrol("dgmain") ,datagid
dg.datasource=ds
dg.databind
ولی در زمان اجرا مقدار dg برابر nothing میشه
فکر کنم دلیلش اینه که وقتی از دستور response.write استفاده میکنیم مقادیر htmlرو در قسمت <form> نمیسازه بلکه خارج از اونه
نمیدونم چجوری این مشکل رو حل کنم .لطفا راهنماییم کنین.