|
get data from SQL2005 into SQL2000 Server
|
|
|
|
|
What a great post, care to explain more and in a more polite manner
|
|
|
|
|
Can someone tell how can I pass a C# variable value as a parameter in a javascript function please?
because i am still not so confident in scripting
thanks
|
|
|
|
|
Basically, you need to use registerclientscriptblock to create a javascript variable which has the C# value as it's value. As in:
int c = "string";
RegisterClientScriptBlock("cStrig", "var str = '" + c + "'");
Of course you need to emit script tags as well, but that's the overall idea. You need to create a javascript variable that contains the value you want to pass through. The most likely reason to do this is to get the client side id of a control on the client side, where you use code like:
RegisterClientScriptBlock("textbox1", "var textbox1Id = '" + textbox1.ClientID + "'");
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
var foo = '<%= txtFoo.Text %>';
Glad to discuss with you and best wishes.
|
|
|
|
|
I have two Buttons(Edit and Delete) inside UpdatePanel. Edit is worhing properly. When I first click on the Delete button it is not woring. But if I click on it for the second time,it is working. Why?
modified on Thursday, March 27, 2008 3:57 AM
|
|
|
|
|
If I could see your code, I'd try to comment on it.
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
It could be that you need to set the focus on the delete button although like the post above i think you will need to show your code for us to help you further
|
|
|
|
|
Might be you are populating any data sorce which is not again bind again
you need to bind that data again check it or show your code
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
<asp:datalist id="MyDataList" runat="server" datakeyfield="Photoid" onitemcommand="MyDataList_ItemCommand" ondeletecommand="MyDataList_DeleteCommand" repeatcolumns="3" repeatdirection="Horizontal" height="307px" width="547px" bordercolor="Gray" borderstyle="Solid" borderwidth="1px">
<itemtemplate>
<asp:imagebutton id="ImgBtn1" runat="server" width="80px" height="80px" imageurl=""><#databinder.eval(container.dataitem, )%="">'/>
<asp:updatepanel id="UpdatePanel1" runat="server">
<contenttemplate>
<asp:label id="title" runat="server" text="">]]>' Font-Names ="Verdana" Font-Size ="8pt" >
<asp:textbox id="TextBox1" runat="server" font-names="Verdana" font-size="8pt" visible="false" text="">]]>' >
<asp:button id="EditBtn" runat="server" text="Edit" font-names="Verdana" font-size="8pt" commandname="Edit">
<asp:button id="Button1" runat="server" text="Delete" font-names="Verdana" font-size="8pt" commandname="Delete">
The above is the aspx page. And in code behind page
protected void MyDataList_ItemCommand(object source, DataListCommandEventArgs e)
{
string id = e.CommandName.ToString ();
if (e.CommandName == "Delete")
{
DBLibrary ob = new DBLibrary();
ob.path1 = Server.MapPath("Database/BlogSiteData.mdb");
string uid = Session["user"].ToString();
string photoid = MyDataList.DataKeys[(int)(e.Item.ItemIndex)].ToString();
System.IO.File.Delete(Server.MapPath("Albums/" + uid + "/" + photoid + ".jpg"));
string sqldel = "Delete from Albums where Userid='"+uid+"' and Photoid=" + int.Parse(photoid) + " ";
ob.ExecuteNonQuery(sqldel);
BuildGrid();
}
}
|
|
|
|
|
try putting a simple bit of code in the command for delete so you can check that is working and then you can go through the exisiting code and see which part of that is causing the problem
|
|
|
|
|
Just rebind your datalist
MyDataList.datasource=Sorceid
MyDataList.databind();
Might help you
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
I am working on london restaurant web application.
<asp:LinkButton ID="lnkBack" runat="server" PostBackUrl="javascript:history.go(-1);">Goback</asp:LinkButton>
above code is working fine means when click on this Goback link previous visited page is coming
but
when I finish booking for restaurant then this link not working. why ?
for booking I am accessing LiveBooking Network using web service.
when I click on Goback link before finally booking completed then also it's working fine.
thanks
You get the best out of others when you give the best of yourself.
|
|
|
|
|
May be it is happening boz when U click Back before finish booking then the previous page is in the memory but when u click Back after booking then the page of booking.aspx is post back and become the previous page in momory so when u click Back the it redirect to the booking page so u'll have to save the previous page name with the checking of that booking page is not post back
Hope it will help u to solve your problem
Enjoy Programming!
|
|
|
|
|
Hi all
I m using Asp.net(Vb) and When the user wants to delete the item i'll have to show a Message Box with Ok and Cancel.
In Vb.net we can use Msgbox() but in asp.net it gives error so i'll have to use javascript' alert function() for it but how can i use it in my code file abc.vb not in the abc.aspx(source file).
And if i use it in source file then how can i access the result(ok or canel) in my code file' button click event???
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
Dim result As MsgBoxResult<br />
result = MsgBox("Do you want to delete the record permanantely?", MsgBoxStyle.OkCancel)<br />
<br />
If result = MsgBoxResult.Ok Then<br />
Sql = "Delete from items where userid=" & Session("userid") & " and itemid=" + itemid.ToString<br />
cmd = New SqlCommand(Sql, cnn)<br />
cmd.CommandType = CommandType.Text<br />
<br />
Me.cnn.Open()<br />
Me.cmd.ExecuteNonQuery()<br />
Me.cnn.Close()<br />
<br />
Me.add_record()<br />
End If<br />
End Sub
Thanks with anticipation...
|
|
|
|
|
In ASP.Net u can use Javascript confirm for this purpose.
based on return value of confirm u can delete the record.
Nothing is Impossible. Keep always Smiling...
|
|
|
|
|
Thanks for your response but sir as i mentioned earlier i know that i can use javascript's alert function but how can i use it in my code file
private sub button1_click(BYVAL sender as object,byval e as eventargs)
result=<java script="">alert("Do you want to delete the record permanantely?")
and if i use it in source file than
how can i access the result( ok or cancel)
result = alert("Do you want to delete the record permanantely?")
from my code file?????
I hope u'll understand my problem
Looking forward 4 your response
|
|
|
|
|
u use VB as a code behind language.
in Inline code U can use Javascript.
for ex.
Inline code
----------
script>
function check()
{
if(confirm("Do u want to delete"))
return true;
else
return false;
}
/script>
asp:button text="delete" id="b1" onclick="b1_click" onclientclick="return check()" /
Nothing is Impossible. Keep always Smiling...
|
|
|
|
|
Your help was great but Can i ask more boz actully i m using grid view and in my grid view there is a column Delete so when the user clicks on delete i'll have to ask that wether he is sure or not and how can i add these line for grid view
asp:button text="delete" id="b1" onclick="b1_click" onclientclick="return check()" /
Thanks for your idea...
|
|
|
|
|
~V~ wrote: result=alert("Do you want to delete the record permanantely?")
No, that just plain does not work. Buy a book on ASP.NET and read it, please.
It looks to me like what you want to do, is that have the button that does the deleting, call some script on the cleint to prompt the user, and only do the postback ( and therefore the delete ), if they click yes.
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
result=alert("Do you want to delete the record permanantely?")<br />
I wrote this just to specify what i wanna do its not the correct syntax i know sir and i m newbie in asp.net
|
|
|
|
|
~V~ wrote: i m newbie in asp.net
Then why are you writing code that will delete someones database records ? Tell me this is homework and not paid work ?
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
For your kind information its not my home work its my project and i m not a student, i m a software engineer and have experience of more than 1 year in vb.net and now i wanna work in asp.net that's why is said that i m newbiew to asp.net.
I respect all the senior person in codeproject boz of their helping nature and once you also helped me to solve my problem and i m still greatful for that but that doesn't means u can say anything to me.
Its not the right way to talk someone being a senior person
Any ways let it go.........
|
|
|
|
|
I'm sorry to say that you've proven my point. You've used VB.NET for one year ? A computer science course takes 3-4 years, and you list no other languages, how much of the one year of your life that you've known how to write a bit of code, were you paid for it ? You're obvioulsy learning ASP.NET by taking paid projects in it, that is just plain disgusting, but not surprising, given the bad experiences I've had with Indian outsourcing companies.
As far as I can see, a lot of outsourcing firms hire people who have no idea, and then expect the people in the West who are losing their jobs as a result, to do their work, on the basis of their inability and unwillingness to buy books, use google, and spend some time learning before they expect to be paid for their efforts.
I am always happy to help people, that's why I am here. But, the direction our industry is taking is upsetting to me. I take solace in the fact that outsourcing companies are still offering poor quality of code and inexperienced workers, I feel sure I'm not going to see my job threatened, but I feel equally sure that in the eyes of those stupid enough to use outsourcing companies, what I do is being devalued.
You refer to me as a senior person. I can tell you for sure, that if I interviewed someone for an ASP.NET position, and they didn't know the things you obviously didn't know from your first post, I would not even consider them. I would probably tell war stories about the person who needed to be in college, not trying to be paid for their efforts. But, you are not alone. The double tragedy is that people where I live can't find good developers, I know of many companies that cannot find a skilled dev because people have left computer science, wrongly thinking there would be no work. I have recently been paid $80 an hour by a company that can't find skilled worker locally, and have tried to outsource briefly and found just what a nightmare it is for all but the most menial tasks. That's $166,000 a year, less than I earn, but 3 times what the average developer used to make around here.
So, please don't tell me what the right way is to talk. I've helped you, and I've also tried to make you realise just how far you have to go before you can hold your head up high when asking to be paid for writing ASP.NET code. My desire in doing this is to inspire you to actually rise above the standards of those around you, and do some study, to become an actual software engineer, able to do research, able to understand the frameworks you are using, able to do your job without bringing your most basic questions here. I know that often I don't tell people what they want to hear around here, but I always try to tell them what they need to hear, if they are to stand any chance of making it as developers. I'm trying to help people, not win their friendship. It's sad that nowadays I have to choose between those two things sometimes.
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
Almost as good as "How to Use Google".
* golfclap *
|
|
|
|