|
Thanks got it sorted yeah was because I was using request. I know the id being past as an integer so renamed and kept as integer works fine. Thanks guys for the help.
|
|
|
|
|
Hi All,
I have added a user control at runt time to my web form. But the button click event in the user control is not working. The control itself is not going in to the event handler. Please can any body help me. And I am using the below code
protected void LoadExampleUserControl()
{
try
{Control controlToLoad;
controlToLoad = this.LoadControl(pathToUserControls);
controlToLoad.EnableViewState = true;
this.div1.Controls.Add(controlToLoad);
}
catch { }
}
And I am calling this method in Page load event. I am I doint wrong. If so please give me suggestion. Or any help.
Thanks,
Aleem Mohammad.
S/W Engineer
Akebono Soft Technologies
aleem_abdul@akebonosoft.com.
|
|
|
|
|
Make sure you are not calling this function inside !IsPostBack block. You need to add user control each time when page refreshes. AFAIK, page_load is not a safe place for dynamic controls. Override OnInit event and add your control there, ASP.NET can manage viewstate for this control then. Don't check IsPostBack there.
|
|
|
|
|
Thanks it is done Nav. Thank you very much.
S/W Engineer
Akebono Soft Technologies
aleem_abdul@akebonosoft.com.
|
|
|
|
|
I've just spent about two hours figuring out why a simple FormView, with only an InsertItemTemplate, and a SqlDataSource with a simple stored proc insert command, just would not insert. No exception was thrown, and even the ItemInserted event was firing, but in the DB? Nadda!
Then I realised I was probably adding a bad parameter to the Values collection in the ItemInserting even, and sure enough, the code below works because the commented out line refers to a non-existent parameter, but nothing tells one this. I like exceptions!
<code>
protected void fvTest_ItemInserting(object sender, FormViewInsertEventArgs e)
{
e.Values["commentTypeId"] = 1;
//e.Values["feedbackRefNum"] = GetFeedbackRefNo();
}
</code>
|
|
|
|
|
Brady Kelly wrote: an InsertItemTemplate, and a SqlDataSource with a simple stored proc insert command
Arrghhhhh. I hate the ...DataSource objects. It's such an untidy hack.
|
|
|
|
|
Wonderful for quick prototyping, or even real use, in very simple capture - view applications. Especially useful where the data structures change often.
|
|
|
|
|
Nope - the SqlDataSource is the hellborn son of Stan.
|
|
|
|
|
Pete O'Hanlon wrote: hellborn son of Stan
Can I assume the misspelling is intentional?
|
|
|
|
|
Brady Kelly wrote: SqlDataSource
That stuff is nasty, I never use it
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I actually like it, this is the first time I've been bitten.
|
|
|
|
|
Hi all,
I am creating my database using the server explorer in VS 2005, I defined almost all tabes and relations I need except that I don't know how to impose a 'unique' constraint on a specific column called "username".
Any idea on how to do this using Server explorer?
Thanks
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
This isn't the right forum for SQL questions. You should use the SQL forum in future.
Open your table in design mode. From the 'Table Designer' menu, select Indexes/Keys. Create a new index and set its 'Is Unique' property to True.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Thanks for the answer.. Done!
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
hello all,
i need to know if i can call the web form as if it is a class that i can inherite or take an object of it
thanks in advance
abdelhameed81
|
|
|
|
|
abdelhameed81 wrote: i need to know if i can call the web form as if it is a class that i can inherite or take an object of it
You could have a number of of web forms that inherit from the same code-behind class.
I can't imagine why you would want to create an instance of a web form code-behind class on its own though. Maybe you can further clarify what you want to achieve.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
thanks for replying. The idea is that i need to access a control inside that form to make some modifications in that user control instead of creating many user controls with some minor changes.
I hope that i made the idea clearer. Thanks
|
|
|
|
|
This sounds like a horrible idea. I would strongly discourage it.
What kind of minor changes are you talking about? If they are cosmetic changes, you could consider writing a templated user control where the presentation can be modified for each instance.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
mmmm
this sounds like a good idea, thanks for your support
|
|
|
|
|
Your web form is a class already. You can inherit from it, create an instance of it (making an object of it) and so on.
But, why would you want to create one outside of the context that ASP.NET creates it for you in the first place?
|
|
|
|
|
thanks
please refer to my reply on pmarfleet
Br,
|
|
|
|
|
Hi All,
I want to add a User Control at runtime. Like the user control should be added when a particular button on the another user control is clicked. And if not clicked it shouldnt be displayed.
And maintain the view state of the controls which are inside the User Control. Can anybody please help me in this.
Thanks,
Aleem Mohammad.
S/W Engineer
Akebono Soft Technologies
aleem_abdul@akebonosoft.com.
|
|
|
|
|
In order to dynamically add a user control (or any control for that matter) to the page you need to add it to an appropriate controls collection. Each control has a controls collection as does the page.
So, create your user control then add it to the controls collection you want (probably the page, or possibly the controls collection of the other user control)
Remember dyanmically created controls will not be recreated at each postback. It is your responsibility to recreate the control on each post back. So long as you create the control during the page load event then you will get the viewstate along with it. (Although, maybe not in during the Page Load event itself).
|
|
|
|
|
Hi,
i have uploaded my site to web server goddady.com
i have a button to download dyanmically generated excel file.This button is ajax enabled.....When i am click on this button it will popup a message like
"That assembly does not allow partially trusted callers"
This is my web.config file
Code: ( xml )
1. <?xml version="1.0"?>
2.
3. <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
4.
5. <configSections>
6. <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectio nGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
7. <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
8. <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHa ndlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
9. <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSecti onGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
10. <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializatio nSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>
11. <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSe ction, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
12. <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationSe rviceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
13. </sectionGroup>
14. </sectionGroup>
15. </sectionGroup>
16. </configSections>
17.
18. <appSettings>
19.
20. </appSettings>
21. <connectionStrings/>
22. <system.web>
23.
24. <compilation debug="false">
25. <assemblies>
26. <add assembly="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
27. <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
28. <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
29. <add assembly="System.Messaging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
30. <add assembly="System.Configuration.Install, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
31. <add assembly="System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
32. <add assembly="Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"/>
33. <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
34. </assemblies>
35. <buildProviders>
36. <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
37. </buildProviders>
38. </compilation>
39.
40. <authentication mode="Windows"/>
41.
42. <pages styleSheetTheme="Smoke">
43. <controls>
44. <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
45. </controls>
46. </pages>
47.
48. <customErrors mode="Off" defaultRedirect="Error.aspx">
49. </customErrors>
50.
51. <httpHandlers>
52. <remove verb="*" path="*.asmx"/>
53. <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
54. <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
55. <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
56. </httpHandlers>
57. <httpModules>
58. <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
59. </httpModules>
60. <identity impersonate="true" />
61.
62. </system.web>
63.
64. <system.web.extensions>
65. <scripting>
66. <webServices>
67.
68. </webServices>
69.
70. </scripting>
71. </system.web.extensions>
72. <system.webServer>
73. <validation validateIntegratedModeConfiguration="false"/>
74. <modules>
75. <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
76. </modules>
77. <handlers>
78. <remove name="WebServiceHandlerFactory-Integrated"/>
79. <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
80. <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
81. <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
82. </handlers>
83. </system.webServer>
84.
85. </configuration>
This code below is for generating Excel
//launch an excel instance
Excel.Application excel = new Excel.ApplicationClass();
//set the visibility to true
excel.Visible = false;
//Add a workbook object
Excel.Workbook workbook = excel.Workbooks.Add(Server.MapPath("~\\General\\Invoice\\Invoice.xlt"));
//Create a worksheet object
Excel.Sheets sheets = workbook.Worksheets;
//from the collection of worksheet select one worksheet
Excel.Worksheet mySheet = (Excel.Worksheet)sheets.get_Item("Invoice");
//select the cell in the worksheet
Excel.Range name = (Excel.Range)mySheet.get_Range("B8", "B8");
Excel.Range school = (Excel.Range)mySheet.get_Range("B9", "B9");
Excel.Range street = (Excel.Range)mySheet.get_Range("B10", "B10");
Excel.Range city = (Excel.Range)mySheet.get_Range("B11", "B11");
Excel.Range tel = (Excel.Range)mySheet.get_Range("B12", "B12");
Excel.Range date = (Excel.Range)mySheet.get_Range("F3", "F3");
Excel.Range invoiceNo = (Excel.Range)mySheet.get_Range("F4", "F4");
Excel.Range dueDate = (Excel.Range)mySheet.get_Range("F15", "F15");
//assign text value to string
string contact = lblName.Text;
string schoolName = lblSchName.Text;
string address = lblStreet.Text;
string state = lblCity.Text;
string telephone = lblTel.Text;
string currentDate = lblDate.Text;
string invoiceNumber = lblInvoiceNo.Text;
string dateDue = lblDueDate.Text;
//Add a text in the cell
name.Value2 = contact;
school.Value2 = schoolName;
street.Value2 = address;
city.Value2 = state;
tel.Value2 = telephone;
date.Value2 = currentDate;
invoiceNo.Value2 = invoiceNumber;
dueDate.Value2 = dateDue;
string url = Server.MapPath("~\\General\\DownloadInvoice\\Invoice.xls");
try {
FileInfo TheFile = new FileInfo(url);
if (TheFile.Exists)
{
File.Delete(url);
workbook.SaveAs(url, Excel.XlFileFormat.xlWorkbookNormal, null, null, false, false, Excel.XlSaveAsAccessMode.xlShared, false, false, null, null, null);
workbook.Close(false, null, null);
}
else
{
workbook.SaveAs(url, Excel.XlFileFormat.xlWorkbookNormal, null, null, false, false, Excel.XlSaveAsAccessMode.xlShared, false, false, null, null, null);
workbook.Close(false, null, null);
}
}
catch (FileNotFoundException ex) { }
Please help me on this issue?
|
|
|
|
|
Hi All!
Im have a problem of using crystal report with web page.currently im using crystalViewer in different page (that is in different folder,and also view the report as another new web page not the same one), and my main form is in the fifferent folder, i have code databinding and parameter setting also in that crystalviewer page,that is not working properly some of mistakes are there,if someone know any better idea with this pls help me to solve this.
|
|
|
|
|