Hi,
I am using Silverligt 4 application. When I export by default file name should display in the save dialogue box. Please give me a c# code to achieve this in Silverlight 4 application. This is very high priority else give me alternate solution to achive in Silverlight 4 application.
Regards,
Santosh
Answer: 1
That feature was added to the SaveFileDialog control in silverlight 5. Here is a possible work around for silverlight 4 (I did not test):
http://stackoverflow.com/questions/8316799/silverlight-savefiledialog-set-default-file-name
Answer: 2
http://msdn.microsoft.com/en-us/library/system.windows.controls.savefiledialog%28v=vs.95%29.aspx
http://forums.silverlight.net/t/117702.aspx
Answer: 3
hi santoshhegde
private void nmrButton_Click(object sender, RoutedEventArgs e)
{
SaveFileDialog dialog = new SaveFileDialog();
dialog.GetType().GetMethod("set_DefaultFileName").Invoke(dialog, new object[] { "FileName.ext" });
dialog.ShowDialog();
}
Thanks & Regards
Mastan Narravula
Mark as Answer", if it helped you or it might help others too.
Answer: 4
Hi,
This I tried I am getting object refernce not set to an instance of an object error.
Regards,
Santosh
Answer: 5
hi
can u tell which item is getting null here...
Answer: 6
I have done like this:
SaveFileDialog objSFD = new SaveFileDialog() {
DefaultExt = "csv",
Filter = "CSV Files (*.csv)|*.csv|Excel XML (*.xml)|*.xml|All files (*.*)|*.*",
FilterIndex = 1
};
string item = TextBox.Text;
objSFD.GetType().GetMethod(item).Invoke(objSFD, new object[] { item });
Here item will contain text box value that value I want to keep as SaveDialogueBox default file name. Let me know where I am doing wrong.
Regards,
Santosh
Answer: 7
hi santoshhegde keep this and try
objSFD.GetType().GetMethod("set_DefaultFileName").Invoke(objSFD, new object[] { "Mastan" });
Thanks & Regards
Mastan Narravula
Mark as Answer", if it helped you or it might help others too.
Answer: 8
Hi,
With that also I am getting same error : Object reference not set to an instance of an object.
Answer: 9
hi try this
private void nmrButton_Click(object sender, RoutedEventArgs e)
{
TextBox tb = new TextBox();
tb.Text = "NMR";
SaveFileDialog objSFD = new SaveFileDialog()
{
DefaultExt = "csv",
Filter = "CSV Files (*.csv)|*.csv|Excel XML (*.xml)|*.xml|All files (*.*)|*.*",
FilterIndex = 1
};
string item = tb.Text;
objSFD.GetType().GetMethod("set_DefaultFileName").Invoke(objSFD, new object[] { item.ToString() });
objSFD.ShowDialog();
}
Thanks & Regards
Mastan Narravula
Mark as Answer", if it helped you or it might help others too.
Answer: 10
Hi Mastan,
No luck still I am getting same error.
Answer: 11
Hi,
I tried above one no luck still getting same issue.
No comments:
Post a Comment
Send us your comment related to the topic mentioned on the blog