|
![Go to Parent](https://www.codeproject.com/App_Themes/CodeProject/Img/arrow-up24.png) Please accept my apology.
I get frustrated sometimes, and probably should of just been more direct. On the other forum, I just ignore the questions now, and don't get involved anymore.
Diagnostics:
Sometimes you have to work backwards, and look at the final results in the browser output. If the results don't work, you have to pick it apart. So you start at the image tag, inspect the url. test the url in the browser bar.
There's a ton of information in the browser source, it just takes some learning to read the info and understand it. If you code in CSharp, then the principals are the same.
Now you work forward on the source, to make adjustments to what is sent back to the browser.
The most common mistakes I see is in the use of Client Script Manager, and not registering the CS in OnInit. The 2nd mistake is not using CS WebResuorceUrl as the url in the image tag. The image url is a webresource.
Sample Code in vb. This is for you to just get an idea of the stucture and use of of the client script manager, and the webresource url.
Protected Overrides Sub OnInit(ByVal e As System.EventArgs)
MyBase.OnInit(e)
Controls.Clear()
Dim cs As ClientScriptManager = Me.Page.ClientScript
Dim rsType As Type = Me.GetType()
Select Case [Localization]
Case 0
rm = New ResourceManager("Admin_PP_Standard.labels_en", Assembly.GetExecutingAssembly())
ci = New CultureInfo("en-US")
Case 1
rm = New ResourceManager("Admin_PP_Standard.labels_fr", Assembly.GetExecutingAssembly())
ci = New CultureInfo("fr-CA")
Case 2
rm = New ResourceManager("Admin_PP_Standard.labels_es", Assembly.GetExecutingAssembly())
ci = New CultureInfo("es-MX")
End Select
Dim Comment As LiteralControl
Comment = New LiteralControl
Comment.Text = "<!-- SignUp V1.1 for ASP.NET 4.0 -->" & vbCrLf
Controls.Add(Comment)
Dim img_Name As String = Nothing
Dim img_Email As String = Nothing
Dim img_ProgressIndicator As String = Nothing
Dim img_Connect As String = Nothing
Dim img_BG_ModalProgress As String = Nothing
Select Case [Page_ColorTheme]
Case 0
img_Name = cs.GetWebResourceUrl(rsType, "Footer_SignUp.ico-form_person_light.png")
img_Email = cs.GetWebResourceUrl(rsType, "Footer_SignUp.ico-form_envelope.png")
img_ProgressIndicator = cs.GetWebResourceUrl(rsType, "Footer_SignUp.modalProgress32.gif")
img_Connect = cs.GetWebResourceUrl(rsType, "Footer_SignUp.btn-send_it_on_connect.png")
img_BG_ModalProgress = cs.GetWebResourceUrl(rsType, "Footer_SignUp.modal_ProgressIndicator.png")
Case 1
img_Name = cs.GetWebResourceUrl(rsType, "Footer_SignUp.ico-form_person.png")
img_Email = cs.GetWebResourceUrl(rsType, "Footer_SignUp.ico-form_envelope.png")
img_ProgressIndicator = cs.GetWebResourceUrl(rsType, "Footer_SignUp.modalProgress32.gif")
img_Connect = cs.GetWebResourceUrl(rsType, "Footer_SignUp.btn-send_it_on_connect.png")
img_BG_ModalProgress = cs.GetWebResourceUrl(rsType, "SmartWeb.ContactUs.modal_ProgressIndicator.png")
Case Else
img_Name = cs.GetWebResourceUrl(rsType, "Footer_SignUp.ico-form_person.png")
img_Email = cs.GetWebResourceUrl(rsType, "Footer_SignUp.ico-form_envelope.png")
img_ProgressIndicator = cs.GetWebResourceUrl(rsType, "Footer_SignUp.modalProgress32.gif")
img_Connect = cs.GetWebResourceUrl(rsType, "Footer_SignUp.btn-send_it_on_connect.png")
img_BG_ModalProgress = cs.GetWebResourceUrl(rsType, "SmartWeb.ContactUs.modal_ProgressIndicator.png")
End Select
ib_Connect = New ImageButton
With ib_Connect
.ID = [ID] & "_ib_Connect"
.ImageAlign = ImageAlign.Left
.ImageUrl = img_Connect
End With
td_Connect.Controls.Add(ib_Connect)
The 3rd mistake I see is not registering the embedded material in the assemblyInfo.
<Assembly: WebResource("Footer_SignUp.btn-send_it_on_connect.png", "image/png")>
<Assembly: WebResource("Footer_SignUp.ico-form_envelope.png", "image/png")>
<Assembly: WebResource("Footer_SignUp.ico-form_person.png", "image/png")>
The 4th mistake is not using the proper root namespace.
root namespace.imagefilename.extension
Right click your project in ssolution explorer, , select the application tab, at the top, you'll see your Assembly Name and Root Namespace.
The 5th mistake is not declaring the right mimetype in the AssemblyInfo. "image/png"
Now you have the page lifecycle. These are the basic building blocks.
OnPreRender - Really special purpose - You don't need it
OnInit - Create the server controls, and builds the page in server memory as htmltextwriter
OnLoad - Populate the server controls with data. - Override for Page.Load
Render - Write out the htmltextwriter, and send to either design mode or browser window.
////////////////////////////////////////////////////////////////////////////////////////
CreateChildControls - Called automatically, but you can override it
OnLoad - called automatically - but you can override it.
Solution:
You can private message me your browser source, so I can see the end results. Or point me to a url where I can see the html output.
Or you can send me a sample of your code module, so I can see what you have going.
|
|
|
|
|
Hi,
How to create AJAX enabled website in VS 2010
I had placed script manager and update panel.But on each menu su-item click the full page ie header,content placeholder and footer are refreshing.Need help....
S.Guhananth
|
|
|
|
|
Just placing a script manager, or any other control, on the page doesn't make it Ajax. You need to actually write some code, javascript and server-side. I would suggest you do some research and understand what Ajax is and means first.
No comment
|
|
|
|
|
The update panel is part of the System.Web library, in which it allows you do async post-backs to the server, so only the content or HTML markup inside the update panel is makes a round trip to the server, instead of the whole page.
Microsoft AJAX is part of the AJAX Control Toolkit. You have to download the project, and compile it. Then you make a reference to the AjaxControlToolkit.dll inyour project, so you can access the tools.
Search for the AJAX Control Toolkit and you'll get a blue colored website, in which you can test the tools, and download the source. There is a video you can watch as well.
|
|
|
|
|
Hi,
I had downloaded and installed ajax control toolkit and given reference and registered it in aspx page.I had placed update panel and script manager.But still the whole page refreshes.
guhananth.S
|
|
|
|
|
I can't remember what the update panel tag looks like exactly, I write in pure code behind, but make sure you have all the components needed to make an update panel work.
1. Update Panel
2. Content Template Container
3. Trigger - Usually a Async PostBack Trigger.
The content in an update panel will render, but to issue a postback of just it's content, you need a button with a trigger wired to it. The trigger contains the button ID or name, and something else. Just make sure everything is wired up to each other.
Don't copy and paste the code, it's hand written, just reference to give you an idea. But the update panel is not part of the AJAX Control toolkit. It's a member of System.Web.Ext I think.
<asp:updatepanel runat="server" ID="updatepanel_ContactForm" updatemode="conditional">
<asp:contentTemplateContainer runat="server">
<asp:panel runat="server" ID="panel_ContactForm" style="width: 850px;">
</asp:panel>
</asp:contentTemplateConatiner>
</asp:updatepanel>
<asp:trigger ID="bt_ContactForm_Submit_Trigger" ControlTarget="bt_ContactForm_Submit" Event="click">
|
|
|
|
|
Hi,
There is only Content Template and Trigger inside Update panel.That did not work out.
Suggest some url .
Guhananth.S
|
|
|
|
|
Hi All!
I have built a new ASP.NET Web Service and it is working fine. Now, I need to apply validation on inputs within the WSDL of my service like following:
<xsd:simpleType name = "SampleTypeName">
<xsd:restriction base = "xsd:string">
<xsd:pattern value = "\d{20}"/>
<xsd:pattern value = "\d{0}"/>
</xsd:restriction>
</xsd:simpleType>
I've copied this from a WSDL of an existing web service.
I don't if I can do it programattically in my web service or is there some other way to acheive this.
Thanks & Regards
Umair Hafeez Mughal
|
|
|
|
|
That looks like a XSD file to me.
You can do a couple of things, when you define your WSDL or XSD file, like assign a data type, min or max length.
But normally, you validate the xml on the server when you read the data. If it's strings, then you run regex against the values, make sure it's not an sql injector code, or malicious code. If you detect an error, you stop and return an error code and description back to the request, and make the client developer fix his mistake.
If you have fixed values, then you add enumerators to the XSD or WSDL file, so they can only choose from the list.
|
|
|
|
|
hi, excuse me.
now I am creating Crystal report in Visual Studio 2005.
I want to create like that below:
Document1.aspx and ViewReport.aspx file.
When I clicked the link in Document1.aspx then,
it will carry query string value and go to ViewReport.aspx.
ViewReport.aspx will show report corresponding query string value.
|
|
|
|
|
|
I been to this forum discussion you provided.
I don't understand.
I want it in C# code.
pls provide another example, passing query string value to Report in VS2005.
|
|
|
|
|
|
yesterday I tried to display Crystal Report with parameter pass in visual studio 2005,
web application.
thank thatraja.
the link you provided is helpful.
But my problem is not solved yet.
I tried like this tutorial you provided.
But the report automatically request to input parameter in Textbox, when I click "ViewReport" link.
when I typed integer parameter in this textbox, the report show correct result.
I described my problem in detail below.
Let's say two documents.
1. Document1.aspx
2. ViewReport.aspx
First I put hyperlink in Formview of Document1.aspx.
I take ID value using QueryString to another page (ViewReport.aspx), Like below,
using hyperlink tag
href="ViewReport.aspx?id=<%#Eval("id")%>"
then, in ViewReport.aspx.cs, I coded like below,
string id = Convert.ToString(Request.QueryString["id"]); //take query string value
string connStr;
string strSQL;
ReportDocument cryRpt = new ReportDocument();
strSQL = "SELECT * FROM requests WHERE id=" + id; //make sql statement with parameter
ReportDocument rptDoc = new ReportDocument();
connStr = ConfigurationManager.ConnectionStrings["IThelpdeskConnectionString"].ConnectionString;
SqlConnection sqlCon = new SqlConnection(connStr);
DataSet ds = new DataSet();
sqlCon.Open();
SqlDataAdapter da = new SqlDataAdapter(strSQL, sqlCon);
SqlCommandBuilder cmdBldr = new SqlCommandBuilder(da);
da.Fill(ds, "requests");
rptDoc.SetDataSource(ds);
CrystalReportViewer1.ReportSource = rptDoc;
CrystalReportViewer1.RefreshReport();
the Error shows on Line.... rptDoc.SetDataSource(ds);
Invalid file path error
Exception Details: CrystalDecisions.CrystalReports.Engine.LoadSaveReportException: Invalid report file path.
I don't know how to solve this error.
Anyboxy, pls help me.
I am using VS 2005 professional, web application (C#).
|
|
|
|
|
sankooo wrote: the Error shows on Line.... rptDoc.SetDataSource(ds);
Invalid file path error
Exception Details: CrystalDecisions.CrystalReports.Engine.LoadSaveReportException: Invalid report file path. Don't worry, Already I have answered similar question(s) in Q/A section. Check this
Invalid report file path in crystal reports[^]
|
|
|
|
|
so, you mean I need to install crystal report another version.
where I can download later version for visual studio 2005
|
|
|
|
|
sankooo wrote: so, you mean I need to install crystal report another version. No man, that's one of the possible case. But see more there
Application folder permissions
Make sure the application user has sufficient permissions to access all the various resources involved, including:
Read and Write access to the Application folder, sub-folders, and files.
Read and Write access to the Temporary folder and all related sub-folders.
Read and Write access to Microsoft .NET Framework folder and related sub-folders.
Read and Write access to the folder containing the report file to be displayed.
Also, make sure the user credentials supplied when creating the Crystal Report has permission to access the application and the database.
Virtual Directory configuration
See Virtual Directory on Microsoft IIS Does Not Allow Anonymous Access[^] for details.
|
|
|
|
|
Hi there all,
Can you please tell me how to fill several comboboxes with for loop??? Need something like above... I have a string list with names of my comboboxes (combolar)... Thanks in advance...
(AjaxControlToolkit.ComboBox)this.Page.FindControl(combolar.ElementAt(t)).Items.Add()
|
|
|
|
|
Hi,
1.Create a dataset.
2. Populate the dropdown list through the dataset.
SqlConnection mycn;
SqlDataAdapter myda;
DataSet ds;
String strConn;
private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
strConn="Data Source=localhost;uid=sa;pwd=;Initial Catalog=northwind";
mycn = new SqlConnection(strConn);
myda = new SqlDataAdapter ("Select * FROM CategoryTable ", mycn);
ds = new DataSet();
myda.Fill (ds,"Table");
DropDownList1.DataSource =ds.Tables [0] ;
DropDownList1.DataTextField =ds.Tables[0].Columns["CategoryName"].ColumnName.ToString();
DropDownList1.DataValueField =ds.Tables[0].Columns["CategoryId"].ColumnName.ToString();
DropDownList1.DataBind () ;
for (int i =0;i < DropDownList1.Items.Count ;i++ )
{
DropDownList1.Items[i].Attributes.Add("style", "color:" + ds.Tables[0].Rows[i]"CategoryColor"].ToString () );
}
}
}
|
|
|
|
|
Please use <pre> tags around code!
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Hi All
We are facing the issue with my website. we have uploaded the publish version and facing the below error.
Could not load the assembly 'App_Web_ixo69rir'. Make sure that it is compiled before accessing the page.
URL :: http://www.dobazaar.com/book/architecture.aspx
Regards
Keyur Satyadev
|
|
|
|
|
|
any one can tell query or SP how to insert image in sql server
any one give link
as i create table image data type
rizvan sivally
|
|
|
|
|
Have a look at these google results insert images into sql server[^]
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
|