|
C#Coudou wrote: sqlDS.SelectParameters(0).DefaultValue = odrCD; //got an error here sqlDS is not defind ddlItem.SelectedValue = itemCD;
Are you trying to set parameters for a SQL Dataset?
Ask this question yourself, how would you access the dataset at the client side (i.e. in Javascript). Dataset exists on server and your client has no knowledge about it.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
what is sqlDS
You did not defined it anywhere, i hope you are not assuming that if you have declared a variable on the server then it is available on the client side(Javascript). Its not possible to see it.
What are you trying to do?
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
My dear newbie friend,
It's Impossible to manipulate data at SQL Server using Jscript.
Rather make a webservice[^] It will help you to accomplish that using Jscript.
Regards,
Hiren.
modified on Monday, December 20, 2010 4:33 AM
|
|
|
|
|
Hiren the link in your post seems to be broken. Can you fix it?
|
|
|
|
|
Thanks for pointing it out, It is updated accordingly.
|
|
|
|
|
I am new to ASP.NET Development, I have created a web site at which access a database, it works fine at my file system
When I create a Site at the File System say "D:\Work\Websites"
I have a folder "D:\Work\Websites\App_Data" folder where i keep the database file say "sitedata.mdf".
i connect the SQLServer using connection string as
string strConnStr = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\sitedata.mdf;Integrated Security=True;User Instance=True";
it works fine, i mean i am able to access/ manipulate database.
and when i copy the whole site to my web root folder (where my localhost is mapped) and copy the "App_Data" folder as well, i mean the
keeping the same structure (means App_Data folder inside the web root folder (where aspx file is located), it refuses to connect,
and displays a message.
Unable to open Database connection [Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.]
do i need to supply some other arguments, or missing some settings.
i am quite new at this front, please suggest .
thanks
prateek.
|
|
|
|
|
Hi,
Is there any Linq to entities equivalent for DeleteAllOnSubmit??
If not, then is Linq to entities really better than linq to sql? If Yes, then why?
Thanks
|
|
|
|
|
There is no comparison between the two. Linq to SQL is for, well, SQL. Linq to Entities can be used for a variety of objects. DeleteAllOnSubmit would not make since for this because the entities could be from any type of collection; a list of strings, a list of WMI objects, etc. where delete has no meaning, or a very different one.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
seems weird to me but when i try to put a function in a standalone .aspx file i get weird errors
so the file "blah.aspx" starts like:
<%@ Page Language="C#"%>
<%
Response.Write("hellow world");
myFunc();
Response.Write("Bye Bye Cruel World");
bool myFunc()
{
return true;
}
%>
and it won't compile ... says "} expected" and then a bunch of stuff about delegates etc in some randomly named files
anybody got any clue?
thnx
"mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them"
modified on Friday, December 17, 2010 11:27 AM
|
|
|
|
|
They are allowed, but you have to write your methods within a <script runat="server"> tag:
<script runat="server">
bool myFunc()
{
return true;
}
</script>
|
|
|
|
|
Good Day All.
I have two problems , but i will address them in different threads. I have a dropdownlist in a UpdatePanel and on selectedIndex change i am doing something on the server side and the drop-down make the page to flicker. This is the Defination of my page. The dropdown is at the bottom and its bolded
<asp:UpdatePanel ID="UpdateSerials" runat="server">
<ContentTemplate>
<div id ="ParentDiv">
<asp:Panel ID="boxpanel" runat="server">
<table class="style1">
<tr>
<td>
<asp:Label ID="Label24" runat="server" TabIndex="22" Text="Box No:"></asp:Label>
</td>
<td>
<asp:Label ID="lblBoxNumber" runat="server" TabIndex="23" Text="Box Number"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Unit1:"></asp:Label>
<asp:TextBox ID="txtUnitLen1" Width="136px" runat="server" onKeyUp="Jump()" TabIndex="1"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="txtUnitLen1" ErrorMessage="RequiredFieldValidator">*</asp:RequiredFieldValidator>
</td>
<td>
<asp:Label ID="Label11" runat="server" Text="Unit11:"></asp:Label>
<asp:TextBox ID="txtUnitLen11" Width="136px" runat="server" onKeyUp="Jump()" TabIndex="10"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator20" runat="server"
ControlToValidate="txtUnitLen11" ErrorMessage="RequiredFieldValidator">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="Unit2:"></asp:Label>
<asp:TextBox ID="txtUnitLen2" Width="136px" runat="server" onKeyUp="Jump()" TabIndex="1"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="txtUnitLen2" ErrorMessage="RequiredFieldValidator">*</asp:RequiredFieldValidator>
</td>
<td>
<asp:Label ID="Label12" runat="server" Text="Unit12:"></asp:Label>
<asp:TextBox ID="txtUnitLen12" Width="136px" runat="server" onKeyUp="Jump()" TabIndex="11"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator19" runat="server"
ControlToValidate="txtUnitLen12" ErrorMessage="RequiredFieldValidator">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label3" runat="server" Text="Unit3:"></asp:Label>
<asp:TextBox ID="txtUnitLen3" Width="136px" runat="server" onKeyUp="Jump()" TabIndex="2"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
ControlToValidate="txtUnitLen3" ErrorMessage="RequiredFieldValidator">*</asp:RequiredFieldValidator>
</td>
<td>
<asp:Label ID="Label13" runat="server" Text="Unit13:"></asp:Label>
<asp:TextBox ID="txtUnitLen13" Width="136px" runat="server" onKeyUp="Jump()" TabIndex="12"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator18" runat="server"
ControlToValidate="txtUnitLen13" ErrorMessage="RequiredFieldValidator">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label4" runat="server" Text="Unit4:"></asp:Label>
<asp:TextBox ID="txtUnitLen4" Width="136px" runat="server" onKeyUp="Jump()" TabIndex="3"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"
ControlToValidate="txtUnitLen4" ErrorMessage="RequiredFieldValidator">*</asp:RequiredFieldValidator>
</td>
<td>
<asp:Label ID="Label14" runat="server" Text="Unit14:"></asp:Label>
<asp:TextBox ID="txtUnitLen14" Width="136px" runat="server" onKeyUp="Jump()" TabIndex="13"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator17" runat="server"
ControlToValidate="txtUnitLen14" ErrorMessage="RequiredFieldValidator">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label5" runat="server" Text="Unit5:"></asp:Label>
<asp:TextBox ID="txtUnitLen5" Width="136px" runat="server" onKeyUp="Jump()" TabIndex="4"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server"
ControlToValidate="txtUnitLen5" ErrorMessage="RequiredFieldValidator">*</asp:RequiredFieldValidator>
</td>
<td>
<asp:Label ID="Label15" runat="server" Text="Unit15:"></asp:Label>
<asp:TextBox ID="txtUnitLen15" Width="136px" runat="server" onKeyUp="Jump()" TabIndex="14"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator16" runat="server"
ControlToValidate="txtUnitLen15" ErrorMessage="RequiredFieldValidator">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label6" runat="server" Text="Unit6:"></asp:Label>
<asp:TextBox ID="txtUnitLen6" Width="136px" runat="server" onKeyUp="Jump()" TabIndex="5"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server"
ControlToValidate="txtUnitLen6" ErrorMessage="RequiredFieldValidator">*</asp:RequiredFieldValidator>
</td>
<td>
<asp:Label ID="Label16" runat="server" Text="Unit16:"></asp:Label>
<asp:TextBox ID="txtUnitLen16" Width="136px" runat="server" onKeyUp="Jump()" TabIndex="15"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator15" runat="server"
ControlToValidate="txtUnitLen16" ErrorMessage="RequiredFieldValidator">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label7" runat="server" Text="Unit7:"></asp:Label>
<asp:TextBox ID="txtUnitLen7" Width="136px" runat="server" onKeyUp="Jump()" TabIndex="6"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server"
ControlToValidate="txtUnitLen7" ErrorMessage="RequiredFieldValidator">*</asp:RequiredFieldValidator>
</td>
<td>
<asp:Label ID="Label17" runat="server" Text="Unit17:"></asp:Label>
<asp:TextBox ID="txtUnitLen17" Width="136px" runat="server" onKeyUp="Jump()" TabIndex="16"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator14" runat="server"
ControlToValidate="txtUnitLen17" ErrorMessage="RequiredFieldValidator">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label8" runat="server" Text="Unit8:"></asp:Label>
<asp:TextBox ID="txtUnitLen8" Width="136px" runat="server" onKeyUp="Jump()" TabIndex="7"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server"
ControlToValidate="txtUnitLen8" ErrorMessage="RequiredFieldValidator">*</asp:RequiredFieldValidator>
</td>
<td>
<asp:Label ID="Label18" runat="server" Text="Unit18:"></asp:Label>
<asp:TextBox ID="txtUnitLen18" Width="136px" runat="server" onKeyUp="Jump()" TabIndex="17"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator13" runat="server"
ControlToValidate="txtUnitLen18" ErrorMessage="RequiredFieldValidator">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label9" runat="server" Text="Unit9:"></asp:Label>
<asp:TextBox ID="txtUnitLen9" Width="136px" runat="server" onKeyUp="Jump()" TabIndex="8"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server"
ControlToValidate="txtUnitLen9" ErrorMessage="RequiredFieldValidator">*</asp:RequiredFieldValidator>
</td>
<td>
<asp:Label ID="Label19" runat="server" Text="Unit19"></asp:Label>
<asp:TextBox ID="txtUnitLen19" runat="server" onKeyUp="Jump()" TabIndex="18"
Width="136px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server"
ControlToValidate="txtUnitLen19" ErrorMessage="RequiredFieldValidator">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label10" runat="server" Text="Unit:10"></asp:Label>
<asp:TextBox ID="txtUnitLen10" runat="server" onKeyUp="Jump()" TabIndex="9"
Width="136px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server"
ControlToValidate="txtUnitLen10" ErrorMessage="RequiredFieldValidator">*</asp:RequiredFieldValidator>
</td>
<td>
<asp:Label ID="Label20" runat="server" Text="Unit:20"></asp:Label>
<asp:TextBox ID="txtUnitLen20" runat="server" AutoPostBack="True"
Width="136px" onKeyUp="Jump()" TabIndex="19"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server"
ControlToValidate="txtUnitLen20" ErrorMessage="RequiredFieldValidator">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<table class="style1">
<tr>
<td class="style2" valign="middle">
<asp:Panel ID="Panel1" runat="server">
<asp:Button ID="btnComplete" runat="server" Height="26px"
onclick="btnComplete_Click1" TabIndex="20" Text="Complete" Width="83px" />
<asp:Button ID="btnComplete2" runat="server" CssClass="buttonSubmitHide"
onclick="btnComplete2_Click" Text="Complete" Width="83px" />
</asp:Panel>
<asp:Panel ID="ModalPanel" runat="server" BackColor="Green"
HorizontalAlign="Center" Style="display: none">
<asp:Label ID="lblPanelMessage" runat="server"></asp:Label>
<asp:Button ID="btnCancel" runat="server" Text="Close Me" />
</asp:Panel>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblSerialNumber" runat="server" Text="Serial no length:"></asp:Label>
</td>
</tr>
</table>
</td>
<td valign="top">
<asp:DropDownList ID="ddlAutoText" runat="server"
Height="24px" onselectedindexchanged="ddlAutoText_SelectedIndexChanged"
TabIndex="21" Width="180px" AutoPostBack="True">
<asp:ListItem Value="0">Autonext function disabled.</asp:ListItem>
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
<asp:ListItem Value="4">4</asp:ListItem>
<asp:ListItem Value="5">5</asp:ListItem>
<asp:ListItem Value="6">6</asp:ListItem>
<asp:ListItem Value="7">7</asp:ListItem>
<asp:ListItem Value="8">8</asp:ListItem>
<asp:ListItem Value="9">9</asp:ListItem>
<asp:ListItem Value="10">10</asp:ListItem>
<asp:ListItem Value="11">11</asp:ListItem>
<asp:ListItem Value="12">12</asp:ListItem>
<asp:ListItem Value="13">13</asp:ListItem>
<asp:ListItem Value="14">14</asp:ListItem>
<asp:ListItem Value="15">15</asp:ListItem>
<asp:ListItem Value="16">16</asp:ListItem>
<asp:ListItem Value="17">17</asp:ListItem>
<asp:ListItem Value="18">18</asp:ListItem>
<asp:ListItem Value="19">19</asp:ListItem>
<asp:ListItem Value="20">20</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblMessage" runat="server" ForeColor="Red"
style="font-weight: 700"></asp:Label>
</td>
<td valign="top">
</td>
</tr>
</table>
</asp:Panel>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnComplete" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
as you can see , it is inside the Update Panel , but when i select it flickers. and Below is the code that set the max length of the textboxes
protected void ddlAutoText_SelectedIndexChanged(object sender, EventArgs e)
{
int MaxLength = Convert.ToInt32(ddlAutoText.SelectedValue);
txtUnitLen2.MaxLength = MaxLength;
txtUnitLen3.MaxLength = MaxLength;
txtUnitLen4.MaxLength = MaxLength;
txtUnitLen5.MaxLength = MaxLength;
txtUnitLen6.MaxLength = MaxLength;
txtUnitLen7.MaxLength = MaxLength;
txtUnitLen8.MaxLength = MaxLength;
txtUnitLen9.MaxLength = MaxLength;
txtUnitLen10.MaxLength = MaxLength;
txtUnitLen11.MaxLength = MaxLength;
txtUnitLen12.MaxLength = MaxLength;
txtUnitLen13.MaxLength = MaxLength;
txtUnitLen14.MaxLength = MaxLength;
txtUnitLen15.MaxLength = MaxLength;
txtUnitLen16.MaxLength = MaxLength;
txtUnitLen17.MaxLength = MaxLength;
txtUnitLen18.MaxLength = MaxLength;
txtUnitLen19.MaxLength = MaxLength;
txtUnitLen20.MaxLength = MaxLength;
txtUnitLen1.MaxLength = MaxLength;
}
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Is it browser specific or does it happen with all the browsers?
..Go Green..
|
|
|
|
|
It happens in all Browsers
Thanks for your reply.
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
I have seen this behavior but that's IE6 specific.
Let me check if I could replicate it for all browsers. I will get back to you if I find something relevant.
..Go Green..
|
|
|
|
|
|
Thanks i will look at the Link
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
i decided that i should handle the SelectedIndexchange event on the client side. Now its fine it does not Flicker. I even removed the Autopostback and set it to false.
thanks for your time.
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
I had a similar idea when I saw your code but then I thought that the code you have given may be a part of actual thing that you are implementing. It may require a post-back for server side processing. So I didn't suggest you the JavaScript way of doing this.
Anyways, glad to hear that you finally found a workaround solution.
Vuyiswa Maseko wrote: thanks for your time.
You are welcome.
..Go Green..
|
|
|
|
|
Hai all,
I want to display confirmation message box in Asp.net code behind (C#).
When I save the record i am doing some validations , in the validation function i need to display confirmation message with "yes"
or "no" , if "yes" the save process should be done and if "no" save process should not be proceed .
I have used Page.ClientScript.RegisterStartupScript() ,but it is not working.
I have also tried btnSave.Attributes.Add("onclick", "return confirm()"); but the confirmation message is opened before save .
I need only at the time of validation .
Please Help me.
Thank u
modified on Friday, December 17, 2010 12:42 AM
|
|
|
|
|
<asp:Button ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click" OnClientClick="return confirm('Do you really want to save?');" />
Just use this in your button and I am sure it will work definitely.
|
|
|
|
|
Thanks for the reply
I no need to call the function in onClientClick() , that will work fine .
I need to call the script function only at the server side validation because the confirmation message should work based on the
server side validation.
Thank you
|
|
|
|
|
Can you please show us Page.ClientScript.RegisterStartupScript() , what you've written inside ?
|
|
|
|
|
This is my coding
protected void btnSave_Click(object sender, Infragistics.WebUI.WebDataInput.ButtonEventArgs e)
{
try
{
if (!fnValidate()) return;
else
{
save();
}
}
catch (Exception ex)
{
throw(ex);
}
}
bool fnValidate()
{
Page.ClientScript.RegisterStartupScript(this.GetType(),
"ClientScript", "");
}
Client side function
function confirmUpdate()
{
var agree = vbConfirm(Are you sure do you want to continue ?');
if (agree == true)
{
return true;
}
else
{
return false;
}
}
|
|
|
|
|
priyagee wrote: Page.ClientScript.RegisterStartupScript(this.GetType(),
"ClientScript", "confirmUpdate();</b></blockquote>
See that, you haven't closed with <code></script></code>.
<div class="signature">Regards,
Hiren.
<div class="callout align-center" style="margin:1px"><b><font color="red">My Recent Article:</font></b> - <a href="http://www.codeproject.com/KB/aspnet/Postback_raising_control.aspx">Way to know which control have raised PostBack</a><br /><b><font color="red">My Recent Tip/Trick:</font></b> - <a href="http://www.codeproject.com/Tips/136704/Remove-all-the-HTML-tags-and-display-a-plain-text-.aspx">Remove HTML Tag, get plain Text</a></div></div>
|
|
|
|
|
Ajax Modal Pop Up extender has a ".Show" property... here[^] got some help! It's in your imagination the way you need to use the modal!
|
|
|
|