|
<blockquote class="FQ"><div class="FQA">familyof7 wrote:</div>I got an error that said it couldn't find the function.</blockquote>
This would happen if you made it private. Make it public and I don't see how it could not be visible. Even protected would work, I think. It's not really going to change for the compiler that it's in the code behind.
I can't see any reason for it to need to be static. If it does, tho, the object that raised the event is the sender parameter, so cast that instead of grabbing it by name. ( oops, that doesn't work, sorry. It's not an event, and you are not accessing the control itself. I wish I could see the original post when I reply.... )
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
"The callback method that you specify must be a static method on the page or user control that contains the Substitution control."
Well, it looks like it does have to be static, which probably means you can't use it to do what you're trying to do. Unless your page will only ever have one user at a time, otherwise, I see no way out of it.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Yeah, I was thinking that too...could i use an iframe to display the excel file? I still have to get the filename from the database...let me try it this way and hopefully I'll get it working...
|
|
|
|
|
yeah, that would work, I think.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Me again...I've implemented the iframe control, now I'm getting the following error from the browser:
) expected.
Here's the tag:
Am I missing something?
|
|
|
|
|
I think you want = instead of #.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
I use this code to save name of a picture in a table in database.file uploaded on a server but the name of that picture don't save on a database.
please help me.
protected void uploade_Click(object sender, EventArgs e)<br />
{<br />
if (uploadetest.HasFile == false)<br />
{<br />
uploadedetail.Text = "plese select youre file";<br />
}<br />
else<br />
{<br />
string filepath = Server.MapPath("~/pic/" + uploadetest.FileName);<br />
uploadetest.SaveAs(filepath);<br />
string FileName = string.Empty;<br />
FileName = uploadetest.PostedFile.FileName.Substring(uploadetest.PostedFile.FileName.LastIndexOf('\\'));<br />
<br />
<br />
string insertsql="INSERT INTO stt (picture) VALUES (@FileName)";<br />
SqlConnection con = new SqlConnection(connectionString);<br />
SqlCommand cmd = new SqlCommand(insertsql, con);<br />
con.Open();<br />
cmd.CommandText = insertsql;<br />
con.Close();<br />
<br />
}<br />
}
|
|
|
|
|
bbc_sh wrote: string FileName = string.Empty;
Why, when you're about to reset it ?
bbc_sh wrote: uploadetest.PostedFile.FileName.Substring(uploadetest.PostedFile.FileName.LastIndexOf('\\'));
Use Path.GetFileName for this
bbc_sh wrote: string insertsql="INSERT INTO stt (picture) VALUES (@FileName)";
SqlConnection con = new SqlConnection(connectionString);
SqlCommand cmd = new SqlCommand(insertsql, con);
con.Open();
cmd.CommandText = insertsql;
con.Close();
you create a paraterised query, but never add your parameter value. Where did you think that the FileName string got passed to the SQL ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Also, your command is never actually executed against the database. You need to change this:
con.Open();<br />
cmd.CommandText = insertsql;<br />
con.Close();<br />
to this:
con.Open();<br />
cmd.CommandText = insertsql;<br />
cmd.ExecuteNonQuery();
con.Close();<br />
Also, as Christian mentioned, you need to set the parameter value:
<br />
cmd.Parameters.Add("@FileName", DbType.Varchar, 500);<br />
cmd.Parameters["@FileName"].Value = FileName;
|
|
|
|
|
I have the following templatefield in my gridview.
I wanted to show the value from my datasource in it but it doesnt show up, it shows error message:
Databinding expressions are only supported on objects that have a DataBinding event. System.Web.UI.WebControls.ListItem does not have a DataBinding event.
<asp:templatefield headertext="Activity Order" xmlns:asp="#unknown">
<itemtemplate>
<asp:dropdownlist id="ddorder" runat="server" datasourceid="SqlDataSource1">
<asp:listitem text="<%# Eval(" order")="" %>"="" value="<%# Eval(">
is there a way to show values in a dropdownlist?
thanks
|
|
|
|
|
Yes. However, not the way you're doing it. I think you need to use the itemdatabound event, find your control and bind it to a source there.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
If I have got my datasource set in my aspx page how do I set a value selected from that query to my dropdown
i have this
DropDownList dd = ((DropDownList)row.FindControl("ddorder"));
dd.DataValueField =
thats in my databound event but how do I set it to the field from the query. I'm not sure of the syntax.
In my aspx the other fields in the gridview are just set like normal bound fields
|
|
|
|
|
I have no idea, I'd never use that nasty 'set a data source in the presentation layer' stuff that MS has built in to ASP.NET in recent times.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Ok, if i set my datasource in the c# instead like:
SqlDataSource1.SelectCommand = "select field from table"
how do I reference a field from that?
|
|
|
|
|
I believe you set the DisplayMember property to the name of the column you want to show.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Hi
sqldatasource does not have that attribute.
thanks anyway I will try the web.
cheers
|
|
|
|
|
No, the drop down list does.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Imagine this is my initial page DSIHome.aspx
I need to implement AJAX in existing project, my requirement is………
I have a menu with sub menus,, which is again generated dynamically (XML).
On clicking in any of the sub menus, I pass the argument to the URL , just like below
location.href="DSIHome.aspx?hdnfld=" + obj + "&catName="+ catName ;
this will initiate the postback and pass the values to the URL,
and I can retrieve the form content based on the URL values using QueryString,
my part here is to STOP postback,
i need to implment AJAX and stop the postback happening while clicking the sub menu
do u have any suggestion for this ?
winnie
|
|
|
|
|
The URL does not change when you use AJAX, so you need to rethink your whole approach. You could pass the values via the AJAX call and store them in jscript if you need them locally.
What's on the page, that is, what sort of navigation are you hoping to replace with AJAX ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
thanks for the quick reponse,
I havent found the method to solve the problem, i can take your suggestion using AJAX call, can you provide me with links, samples on how to implement that.
regards
winnie
|
|
|
|
|
Umm.... I asked you some questions, could you answer them ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
the page contains treeview and 2 datalist, the data on these controls is loaded based on the values on the URL,
as you said the values should be available locally ,
hope im conveying the problem in right words
regards
winnie
|
|
|
|
|
OK, you should use ASP.NET AJAX for this, which will just wrap everything for you. Trying to populate those controls using your own JS is a PITA. If you put everything in an update panel, it will just AJAX it for you.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
|
Hi Guys,
When i LogOut a user on my site a User is still able to hit the Back button in their browser and essentially view a logged in only page.
Ideal scenario would be for this page to send them to Login screen.
What would be the best way to stop this from happening?
FYI.
When a user logs in, i store a loggedIn value in a session variable.
On logout i reset this session to indicate the user is loggedOut.
I am using c# .net
Many Thanks.
|
|
|
|