My requirement is to develop a webpage where I have bind a treelist with database and based on user click on the treelist I have to show new textbox to add something to the Database. But using DevExpress I am unable to do that. Though I have found one sample answer from other forum which shows like below:
private void treeList1_Click(object sender, System.EventArgs e)
{
DevExpress.XtraTreeList.TreeList tree = sender as DevExpress.XtraTreeList.TreeList;
DevExpress.XtraTreeList.TreeListHitInfo info = tree.CalcHitInfo(tree.PointToClient(MousePosition));
if (info.HitInfoType == DevExpress.XtraTreeList.HitInfoType.Cell)
{
}
}
But when I try this on my asp.net project it can't find the XtraTreeList from the code behind and I am getting the following error:
The type or namespace name 'XtraTreeList' does not exist in the namespace
'DevExpress' (are you missing an assembly reference?)
Please help me on this. Thanks in advance.
Related
I am trying to load a pdf into a axAcroPDF using this method that I found here. but there isn't a this.axAcroPDF.LoadFile() there. The error message that I get says:
"AxacroPDFLib.AxacroPDF doesn't contain a defection for 'LoadFile' and
no Extension method excepting first method of a type
AxacroPDFLib.AxacroPDF could be found (Are you missing a using
directive or an assembly reference?"
So I double checked and there are Acrobat , AcroPDFLib, AxAcroPDFLib Referances in the WPF and user control.
Next I goggled this again and found this on YouTube that uses this.axAcroPDF.src =path; however I do not this option either. Please tell me if they have changed the LoadFile(path) to something else, or if there is a reference that I am missing?
axAcroPDF1.LoadFile(PDFPath.ToString());
axAcroPDF1.setShowToolbar(false); //disable pdf toolbar.
axAcroPDF1.Enabled = true;
Another solution is to set the src property of your Axacro control.
I'm trying to teach myself C# the program I'm working on has a browser attached to it. I have been trying to figure out how to make it click a button by the tag name but I cant seem to get it to. I have searched this site and found many helpful topics but none yet to help solve this one.
<a class="some_class" style="letter-spacing: -1px" href="/someurl" data-executing="0">displaybuttontext</a>
That is my button I would like to make the program click. But cant get it to. Here are a few ways I have tried:
private void test1_CheckedChanged_1(object sender, EventArgs e)
{
web.Document.GetElementsByTagName("class").GetAttribute("href").invokemember("click");
}
That method didn't it threw up a error with GetAttribute, I then tried:
moco.Document.GetElementById("a").InvokeMember("click");
This doesn't show an error but also doesn't click the button (displaybuttontext). Could someone be kind enough to show a example and explain it. Keep in mind that I'm new to this.
Let's say you have this on the html page:
<a id="link-id" href="linktosomewhere.html">click here</a>
You would want to call:
Document.GetElementById("link-id").InvokeMember("click");
This is because the link element has the attribute id="link-id".
You can see in this article that the parameter you pass to GetElementById needs to be the ID of the element you want to retrieve: http://msdn.microsoft.com/en-us/library/system.windows.forms.htmldocument.getelementbyid(v=vs.110).aspx
Server Error in '/asppub' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1061: 'ASP.mis3200_unit4_ringu4pos_aspx' does not contain a definition for 'rblSnacks_SelectedIndexChanged' and no extension method 'rblSnacks_SelectedIndexChanged' accepting a first argument of type 'ASP.mis3200_unit4_ringu4pos_aspx' could be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 102: Would you like any snacks?</td>
Line 103: <td class="style7">
Line 104: <asp:RadioButtonList ID="rblSnacks" runat="server"
Line 105: RepeatDirection="Horizontal" Width="96px" AutoPostBack="True"
Line 106: onselectedindexchanged="rblSnacks_SelectedIndexChanged">
Source File: c:\Users\Ryan\Desktop\asppub\MIS3200\Unit4\RingU4POS.aspx Line: 104
The given error message in my coding class was this:
Snacks: toggle visiblity based on yes/no selection: -2
The list of snacks should only be visible when somebody selects Yes (otherwise, it should be invisible). You needed to double-click the RadioButtonList to create a method which had functionality to toggle the visibility property of the CheckBoxList. For this method to work, you must enable AutoPostBack for the RadioButtonList. "
What am I doing wrong? Any help would be appreciated.
You have missed this in server side
protected void rblSnacks_SelectedIndexChanged(object sender, EventArgs e)
{
}
Add this code in your code behind
protected void rblSnacks_SelectedIndexChanged(object sender, EventArgs e)
{
// some code
}
You should define a rblSnacks_SelectedIndexChanged method in a code behind that will handle the SelectedIndexChange event for the radio button. And if you do not need it, you should remove it.
As the error suggests, you have to have the SelectedIndexChanged in your code behind. So add this code,
protected void rblSnacks_SelectedIndexChanged(object sender, EventArgs e)
{
//your code;
}
I am developing a website, in which i have to upload excel file. I have a form which is placed inside an UpdatePanel. When i use this code:
protected void uploadClick(object sender, EventArgs e)
{
string extension = Path.GetExtension(Uploader.PostedFile.FileName);
}
From the above line..I am checking the extension of the file. If it would be other than .xlsx , i will prompt user that such type of file is not allowed. But the problem is that
Uploader.PostedFile.Name is giving null error exeception. This is error message:
NullReferenceException was unhandled by user code
Kindly help me how to handle this situation. Regards
Ok, because you are using uploader inside UpdatePanel it won't work. There are two things you can do:
Use full postback for uploader by utilizing UpdatePanel Triggers, more info here http://www.asp.net/web-forms/tutorials/aspnet-ajax/understanding-asp-net-ajax-updatepanel-triggers
Use Async Uploader from ajax toolkit http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/AsyncFileUpload/AsyncFileUpload.aspx
I have a xaml page samplePage.xaml and its corresponding .cs file samplePage.xaml.cs. In this page there is a textBox textBox1.
Now I create an instance of the page:
PhoneApp1.samplePage s = new PhoneApp1.samplePage();
and after that, I would like to set the value in the text box by calling:
s.textBox1.Text = "whatever"
but it turns out there is an error message saying
'PhoneApp1.samplePage' does not contain a definition for 'textBox1'
and no extension method 'textBox1' accepting a first argument of type
PhoneApp1.samplePage' could be found (are you missing a using
directive or an assembly reference?)
I would like to know how to get the xaml element using C# code?
You textbox is probably private or protected. Add a wrapper in your page to expose the textbox, something like :
public TextBox TextBox1
{
get
{
return this.textBox1;
}
}
(mind the case)
Then just use the property from anywhere you want: s.TextBox1.Text = "whatever";
Good question, you'll need to use XamlReader.Load to load your page/control at runtime, then you'll be able to access the controls within it:
http://msdn.microsoft.com/en-us/library/cc189076(v=vs.95).aspx#using_xamlreaderload
http://blogs.silverlight.net/blogs/msnow/archive/2008/10/09/silverlight-tip-of-the-day-60-how-to-load-a-control-straight-from-xaml.aspx