|
Glad be at your service
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
www.ITS.co.za
|
|
|
|
|
Hi. I am trying to retrieve the text of a textbox from code behind after setting the text via javascript (JS) on the page itself.
I do it like this via JS on a html radiobutton event:
var provider = document.getElementById('<%=txtMailProvider.ID %>');
provider.value = '@blah.com';
I then try to get that text from the txtbox on a server button click event, in code like:
string blah = txtMailProvider.Text; this bring back and empty string.
Is there another, working, way to do this? Tried google, etc
Any help would be great.
Thanks
M
|
|
|
|
|
is '@blah.com' still in the textbox after you press button?
|
|
|
|
|
yes it is, I see it set within the txtbox.
|
|
|
|
|
Firstly, check that EnableViewState hasn't been set to false on your text box.
It's true by default so it will only be false if you or another programmer has added: EnableViewState="false"
|
|
|
|
|
Thanks guys for the help, I am using a hidden input field instead (last resort. )
|
|
|
|
|
Following is my userdefined Template as CoreVocabularyFields.ascx
<%@ Control Language="C#" ClassName="CoreVocabularyFields" %>
<script language="C#" runat="server">
public void PopulateCoreType(object sender, EventArgs e)
{
EntityDropDownList list = (EntityDropDownList)FormUtil.FindControl(((Control)sender).NamingContainer, "dataCoreTypeId");
CoreTypeDataSource datasource = (CoreTypeDataSource)FormUtil.FindControl(((Control)sender).NamingContainer, "CoreTypeIdCoreTypeDataSource");
if (list != null)
{
list.DataSource = datasource;
list.DataTextField = "NetTypeName";
list.DataValueField = "Id";
list.DataBind();
}
}
</script>
<asp:FormView ID="FormView10" runat="server">
<ItemTemplate>
<table border="0" cellpadding="3" cellspacing="1">
<tr>
<td class="literal"><asp:Label ID="lbldataTerm" runat="server" Text="Term:" AssociatedControlID="dataTerm" /></td>
<td>
<asp:TextBox runat="server" ID="dataTerm" Text='<%# Bind("Term") %>' TextMode="MultiLine" Width="250px" Rows="5"></asp:TextBox><asp:RequiredFieldValidator ID="ReqVal_dataTerm" runat="server" Display="Dynamic" ControlToValidate="dataTerm" ErrorMessage="Required"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="literal"><asp:Label ID="lbldataCoreTypeId" runat="server" Text="Core Type Name:" AssociatedControlID="dataCoreTypeId" /></td>
<td>
<table border="0">
<tr> <td valign="middle" style="width:100px;">
<data:EntityDropDownList runat="server" ID="dataCoreTypeId" DataSourceID="CoreTypeIdCoreTypeDataSource" DataTextField="JavaTypeName" DataValueField="Id" SelectedValue='<%# Bind("CoreTypeId") %>' AppendNullItem="true" Required="true" NullItemText="< Please Choose ...>" ErrorText="Required" />
<data:CoreTypeDataSource ID="CoreTypeIdCoreTypeDataSource" runat="server" SelectMethod="GetAll" />
</td>
<td valign="top">
<table>
<tr>
<td><font style="color:Gray; font-weight:bold;">Select By :</font></td>
<td><asp:RadioButton AutoPostBack="true" ID="JavaType" GroupName="CoreType" runat="server" OnCheckedChanged="PopulateCoreType" Checked="true" /></td>
<td><font style="color:Gray; font-weight:bold;">JavaTypeName</font></td>
<td><asp:RadioButton AutoPostBack="true" ID="NetType" GroupName="CoreType" OnCheckedChanged="PopulateCoreType" runat="server" /></td>
<td><font style="color:Gray; font-weight:bold;">NetTypeName</font></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td>
<%----%>
<div id="divAddCoreType" style="display:none;">
<data:MultiFormView ID="FormView2" DataKeyNames="Id" runat="server" DataSourceID="CoreTypeDataSource" DefaultMode="Insert">
<EditItemTemplatePaths>
<data:TemplatePath Path="~/Admin/UserControls/CoreTypeFields.ascx" />
</EditItemTemplatePaths>
<InsertItemTemplatePaths>
<data:TemplatePath Path="~/Admin/UserControls/CoreTypeFields.ascx" />
</InsertItemTemplatePaths>
<EmptyDataTemplate>
<b>CoreType not found!</b>
</EmptyDataTemplate>
<FooterTemplate>
<asp:Button ID="InsertButton" runat="server" CausesValidation="False" CommandName="Insert" Text="Insert" />
<asp:Button ID="CancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</FooterTemplate>
</data:MultiFormView>
<data:CoreTypeDataSource ID="CoreTypeDataSource" runat="server" SelectMethod="GetAll" />
</div>
</td>
</tr>
<tr>
<td class="literal"><asp:Label ID="lbldataMeaning" runat="server" Text="Meaning:" AssociatedControlID="dataMeaning" /></td>
<td>
<asp:TextBox runat="server" ID="dataMeaning" Text='<%# Bind("Meaning") %>' TextMode="MultiLine" Width="250px" Rows="5"></asp:TextBox><asp:RequiredFieldValidator ID="ReqVal_dataMeaning" runat="server" Display="Dynamic" ControlToValidate="dataMeaning" ErrorMessage="Required"></asp:RequiredFieldValidator>
</td>
</tr>
</table>
</ItemTemplate>
</asp:FormView>
In the above code I want to change the DataTextField of the DropDownList(Id: dataCoreTypeId) on the OnCheckedChanged event of the Radio Button
(Having Text as JavaType Name and NetType Name)
I am using this template in the CoreVocabulary.aspx page inside MultiFormView Tag
<%@ Page Language="C#" Theme="Default" MasterPageFile="~/MasterPages/admin.master" AutoEventWireup="true" CodeFile="CoreVocabularyEdit.aspx.cs" Inherits="CoreVocabularyEdit" Title="CoreVocabulary Edit" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">Core Vocabulary - Add/Edit</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<data:MultiFormView ID="FormView1" DataKeyNames="Id" runat="server" DataSourceID="CoreVocabularyDataSource">
<EditItemTemplatePaths>
<data:TemplatePath Path="~/Admin/UserControls/CoreVocabularyFields.ascx" />
</EditItemTemplatePaths>
<InsertItemTemplatePaths>
<data:TemplatePath Path="~/Admin/UserControls/CoreVocabularyFields.ascx" />
</InsertItemTemplatePaths>
<EmptyDataTemplate>
<b>CoreVocabulary not found!</b>
</EmptyDataTemplate>
<FooterTemplate>
<asp:Button ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert" />
<asp:Button ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="Update" />
<asp:Button ID="CancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</FooterTemplate>
</data:MultiFormView>
<data:CoreVocabularyDataSource ID="CoreVocabularyDataSource" runat="server"
SelectMethod="GetById"
>
<Parameters>
<asp:QueryStringParameter Name="Id" QueryStringField="Id" Type="String" />
</Parameters>
</data:CoreVocabularyDataSource>
</asp:Content>
But when I click the radio button I got the error as
Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
Thanks
|
|
|
|
|
Hello,i want to store video and picture file with the unique user(the member or existing user)using SQL2000,the what relation will be suitable,[user table](PK--user_ID
User_Name,User_Password)[Resume table](PK--CV_ID, FK--User_ID,name,father_name ect)[Picture table](PK--Pic_ID, FK--CV_ID,picture,Content type,size,data)[Video table](PK--Video_ID, FK--CV_ID, Video_name,Content type,size,data) is this correct relation ship?and should i use user_id Fk in video and picture table?and also i want show the data for register member.
|
|
|
|
|
in my situation in one click event i have to insert data into a sql table as well as oracle table.Now i want to use transactions but the problem is either i have to use oracle transaction which does not support oracle command or sql transaction which does not support sql command.What i have to do in this situation.I want to do that if one of the two query fails to execute other one must be roll back.
Thanx in advance
|
|
|
|
|
I've never had to deal with transactions across two different providers (oracle and sql server) before but here's something off the cuff. How about adding some kind of 'Pending' state to the inserts
1. Perform first insert (pending)
2. Perform second insert (pending)
3. Validate both have inserted
4. Update first (live)
5. Update second (live)
I know there's still a window for something to fail between operations 4 and 5 but it's much less likely than a failure between 1 and 2 (due to constraints you might have on various fields). A Transaction would be better but this is an option.
|
|
|
|
|
Hi iam working in a project, this is one of my stored procedure which neither allows you to insert duplicate vendor, nor either duplicate email.
but i am wondering whether this is the correct method of doing validation or i create 2 more store procedures 1 for checking duplicate vendor names another for duplicate email and 1 for insertion of vendor record.
ALTER PROCEDURE [dbo].[InsertVendorDetails]
-- Add the parameters for the stored procedure here
(
@strVendorName varchar(50),
@strPrim_Con varchar(12),
@strSec_Con varchar(12),
@strEmail varchar(50)=null,
@strAdd varchar(500),
@result Int output
)
AS
BEGIN
If Exists( Select Vendor_Name from Vendor where Vendor_Name=@strVendorName)
Begin
set @result = 2
End
Else
Begin
If Not Exists(Select email from Vendor where email=@strEmail and email is not null)
Begin
INSERT INTO VENDOR(VENDOR_NAME,PRIM_CONT_NO,SEC_CONT_NO,EMAIL,[ADDRESS])
VALUES(@strVendorName, @strPrim_Con, @strSec_Con, @strEmail, @strAdd )
set @result=@@Rowcount
End
Else
Begin
set @result = 3
End
End
END
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
Programmers always do things Differently,
The First thing i would do i will have a Stored Procedure to check if the e-mail exists and the Vendor name Exist if they dont exists then do the Insert.As i see you have tried to handle them from one SP. Mybe if you can create a SP for checking an e-mail and another one for name and call them from your BLL and check against their return and do decision based on that.
Hope it make sense
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
www.ITS.co.za
|
|
|
|
|
I have to print a UPS shipping label on thermal printer (upslabel.cps). I
initially had the label information in a base64 string which I decoded into a
memory stream. Now I need to send this memory stream to a thermal/label
printer. How do I do this?
I have tryied following code.
its working well for gif string formate but not working in epl string format
string sUploadLabelFileName = "c:\\prem\\label.cps";
string GraphicImage;
GraphicImage = "mystring" ;
char[] data = GraphicImage.ToCharArray();
Base64Decoder myDecoder = new Base64Decoder(data);
StringBuilder sb=new StringBuilder();
byte[] bt64 = myDecoder.GetDecoded();
FileStream sw = new FileStream(sUploadLabelFileName, FileMode.CreateNew);
sw.Write(bt64, 0, bt64.Length);
please help
prem
2
modified on Thursday, February 19, 2009 10:00 AM
|
|
|
|
|
Hi Friends.....,
i can take Modal popup control.using that control display one panel.
in that panel design two fields like email and password, i can take one ADD button,
how to insert values when clicking on ADD button.
|
|
|
|
|
just add an OnClick event handler to ADD button and in this handler you may access the fields and insert whatever you want.
Calin
|
|
|
|
|
just to back up the previous response - you implement it the same way you'd implement it if you wasn't using the modal popup.
Presumably your button is an asp:Button so create your event handler (if you don't know how to write it manually then just double click it in your IDE designer) and add your code. When the button is clicked by a user it will cause a postback and your code will execute.
Have you managed to get your modal box popping up ok?
|
|
|
|
|
hi,
I have page named webform.aspx,in this page i retrived the values from the database to the hiddenfields in the webform page.Now i want to access this hidden field values in the htm page named index.htm
webform.aspx
Hiddenlat.Value= ds.Tables[0].Rows[0]["lat"].ToString();
Hiddenlang.Value = ds.Tables[0].Rows[0]["lang"].ToString();
In index.htm iam trying to access the values of the hidden fields
of the webform.aspx page
index.htm
var lat1=form1.getElementById("Hiddenlat").value;
var lng1=form1.getElementById("Hiddenlang.").value;
but iam unable to acess the hidden field values in the index.htm
Note: we r using iframe for webform.aspx
Thanks in Advance
|
|
|
|
|
Hiya,
try
var lat1 = window.frames(0).document.getElementById('HiddenLat').value;
Works for me - hope it works for you, too
Btw, this is my first post here, hello everyone.
|
|
|
|
|
thanks for reply
i tried that but i did not get
acutally how i am using is
webform.aspx
<html>
<body>
<iframe src="index.htm" />
here is the hidden control with id Hidden1
</body>
</html>
index.htm
<html>
<body>
here i want to show the webform.aspx pages hidden values
</body>
</html>
how to show the hidden control values in index.htm ??
|
|
|
|
|
Sorry, I must have misunderstood your need.
So the iframe is IN the aspx page, not the other way round.
In the script of index.htm use:
var lat1 = window.parent.document.getElementById('Hiddenlat').value;
If that doesn't help i dont know what will.
|
|
|
|
|
thanks buddy.
it was very helpful to solve the problem...
|
|
|
|
|
Hello friends,
m having some problem with dropdownlist, in my code i have to save the selected value in the database and after it i need to remove it from the dropdownlist,
my code is as below
<br />
LevelDBMLDataContext dt = new LevelDBMLDataContext();<br />
LevelMaster lmas = new LevelMaster();<br />
lmas.KMLevel_number = Convert.ToInt32(ddlLevelNumber.SelectedItem.ToString());<br />
lmas.KMLevel_Name = txtLeveName.Text;<br />
lmas.KMLevel_Description = txtDescription.Text;<br />
lmas.KMLevel_Status = getStatus();<br />
dt.LevelMasters.InsertOnSubmit(lmas);<br />
dt.SubmitChanges();<br />
ClearControls();<br />
fillLevelNumber();
but since page load occur before the click button click event it is not working.please help me ...........thanks
|
|
|
|
|
Hi,
How can i maintain server time and client area time.If a client save his local time and location in database, how can i compare with server time.
eg:
A user from india set Indian time and save to server in usa, next time when the user enter he want to check the time he saved.How can i compare time with server time?
thankyou,
yesu
|
|
|
|
|
i think your question is wrong?
when user can login in the system the time or date is save in the database
is server time. its not the client system time. so you don't need to
comapare time?
reply if you need more clarification.
or justify your question in more details.
Regards
Keyur Satyadev
|
|
|
|
|
Hi,
I need to start an action when the saved local time reached. How the server identify the local client time reached?
for eg:
Time saved by a user in india : 5:30 PM.. Server time is 12 PM
When the indian time 5:30 pm reached an action will start.
In server how i will know indian time 5:30 reached?
or how can i know Indian time 5:30 is equal to server time 12 PM?
Thankyou
|
|
|
|