|
i will try to simplify as much as i can what i wrote ahead.
let's say i need WebControl that can manipulate data from database. WebControl should have 3 fields (columns). when editing or inserting data via this control, first field is plain text (TextBox), other two must be falling menus (DropDownList).
in database i have 3 tables
first table have this structure:
------------------------------------------
id | TextField | Foregin1_id | Foregin2_id
------------------------------------------
second and third have this structure:
---------
id | name
---------
i need to join first table with other two, then bind it to WebControl.
so this is my work:
1. i created custom control (class) "MyGird" inherited from the System.Web.UI.WebControls.DataGrid.
2. i created sql query
select
TextField, t2.name, t3.name
from (
table1 t1 inner join table2 t2
on t2.id=t1.Foregin1_id
)
inner join table3 t3
on t3.id=t1.Foregin2_id
3. i created some code in "MyGrid" that examines sql query, creates DataSet and fill it with all 3 tables, and finaly calls DataBind() function from it's base class System.Web.UI.WebControls.DataGrid.
After bind i have "custom datagird" MyGrid. i can edit MyGrid and manipulate (insert, delete, update) data from first table of database in many ways, depending on "some code i created".
so the "problem" is that this "some code i created" is not very "nice". some parts of code is hard to read. globaly this approach doesn't feels right.
so question is; can i use DataRelation for joining data from more tables instead of using sql join? DataRelation seems to me like thing i have been mising for creating "MyGrid" in right way....
|
|
|
|
|
can anybody help me , how to create a chart in crystalreport in bar template or bar model, can give me any link about this or can guid me?
|
|
|
|
|
|
Hi,
I want to update resource file that are already published
Is there any way?
Waiting for quick reply
Known is a drop, unknown is an ocean
|
|
|
|
|
|
Hi,
I have created a web survey control which is working fine, now I have to create same thing for desktop application [Survey control for desktop application].
Please let me know your suggestions.
Can I create a survey type of desktop application in WPF?
I am working in VisualStudio2008 using C#.
Thanks
|
|
|
|
|
Please do not cross post.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Why dont you try out Silverlight...
Silverlight 3.0 has out of browser support. So, you can make a web silverlight applet to work in desktop...
|
|
|
|
|
hi
I want to delete a file(xml file) on page_unload event
as
protected void Page_Unload(object sender, EventArgs e)
{
File.Delete(MapPath(@"~/App_Data/abc.xml"));
}
but it gives error "Object reference not set to an instance of an object." but it working fine on page_load event please suggest me if i am wrong.
Thanks in advanced
Abbas
|
|
|
|
|
Member 3169981,
When you write MapPath, by default it refers to Page.MapPath method. Now in Page_Unload method, page object can not be accessed, therefore Page.MapPath method throws an exception "object reference..."
Instead use, Server.MapPath to delete any file inside your Page_Unload method. Should be fine.
Thanks,
Arindam D Tewary
|
|
|
|
|
Thanks Arindam, now it's working with Server.MapPath()
|
|
|
|
|
Thanks,
Arindam D Tewary
|
|
|
|
|
I have a requirement to place to pagable grid inside a webform and display that form as a pop up from button click other window.
Pop up window should have to take the employee name search string and it should display all the emp details (Id(hided),Name,Deaprtment,Location)
in the gridview through bounded link and text controls.
upon selection of a perticular employee by clicking on the underlying linkbutton pop has to be closed and both name and departnames has to be passed back to the parent window.
i tried by implementing modelDialog windows method
these are the issues i found
1)I can't passback the Binding values to the javascript function
2)When i clicked on the linkbutton in the gridview a new browser window is opening with the do_postback.......... as its url
3)I have seen any javascript block executing on the page.
could anyone give me an idea about how to go ahead with this?
Thanks in advance for any suggestions.
|
|
|
|
|
Hii,
I am doing a community project.There client asked me to implement "cooliris" for pages.Could you guys can help me ?..any idea ?
With warm regards
|
|
|
|
|
Never heard of it but if you check out Google - the top search comes up with a site selling you a Flash 3d viewing app. Maybe that's what they want you to use - or something like it.
|
|
|
|
|
Hi,
I am using fileupload control in asp.net. am selecting the file using browse button of file upload control. But due to postback event of any other control on the page the content(file path) of the fileupload textbox gets cleared... Viewstate is enabled to this control.
How to solve this problem??? am using vs 2008 and c#...
|
|
|
|
|
I believe that is default behaviour. You can retain the text through doing partial postback using update panel. Do not send upload control while doing the postback and it should retian the value.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
I tried like this but not working. Just I placed scriptmanager and updatepanel on the page and kept the fileupload control inside updatepanel... Have I followed correctly???
|
|
|
|
|
Wait a minute, were you referring to postback caused by clicking upload button or some other control?
If you mean after clicking on upload button, I guess it is not possible. Also, AFAIK, you cannot set the text of te textbox in the control so you cannot even keep the file path somewhere and just set it.
If you were referring to some other control which is causing postback, then keep just that control in the update panel and not the upload control.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Well... Html file control is very restrictive control. You cannot set value of file upload using javascript. You can only set using Browse Button.
Now when the page is posted back, the whole page is sent to the server, server processes it and rewrites the whole page to the response and which is written over the browser(client).
Thus if you select a file and some other button makes the postback, dont hesitate to save the file to the server as, the path, if not saved to the server, cant be shown in the file control at any case.
Otherwise you can show a popup (preferably using window.open) to upload files and do the upload immediately after user selects the file.
|
|
|
|
|
How to save and assign to the fileupload control? am trying to assign the path like this
FileUpload1.PostedFile.FileName = "Path"; but getting error "Property or indexer 'System.Web.UI.WebControls.FileUpload.FileName' cannot be assigned to -- it is read only.
any idea??
|
|
|
|
|
save path in any string/contol...
for label control...
label.text=File1.PostedFile.FileName;
|
|
|
|
|
but how to assign string value to fileupload control... I tried but got error messages... pls see my previous post...
|
|
|
|
|
You cannot as I told you. Fileupload should be the last thing to do in a page. Or else, have a listbox/listview (in case of multiple file upload) or a label with remove button or something in your page. That should work.
Something like what we get in Gmail or outlook.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
You cant do that ...
Even ASP.NET cant do this, thus it cant retain its value during postbacks..
Sorry.. You need to store it in server as soon as you find it in server. And then show the message, file uploaded successfully.. .or so...
|
|
|
|