|
hi
any body who knows names of books regarding MCAD windows application Development Exams Perpartion .
regards
|
|
|
|
|
Ok here is my code:
string[] info = new string[2];
info[0] = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString();
info[1] = "OPEN";
SqlDataSource sds = new SqlDataSource(ConfigurationManager.ConnectionStrings["HelpDeskConnectionString"].ConnectionString, "Select ID From [Company_Ticket]");
sds.ID = "SqlDataSource1";
this.Controls.Add(sds);
TextBox txt = new TextBox();
txt.ID = "txtTime";
txt.Text = info[0];
txt.Visible = false;
this.Controls.Add(txt);
txt.ID = "txtStatus";
txt.Text = info[1];
txt.Visible = false;
this.Controls.Add(txt);
QueryStringParameter qsp = new QueryStringParameter();
qsp.Name = "AdminName";
qsp.QueryStringField = "Admin";
qsp.Type = TypeCode.String;
ControlParameter cp = new ControlParameter();
cp.ControlID = "TextBox2";
cp.Name = "Issue";
cp.Type = TypeCode.String;
sds.InsertParameters.Add(cp);
cp.ControlID = "TextBox1";
cp.Name = "Company";
cp.Type = TypeCode.String;
sds.InsertParameters.Add(cp);
cp.ControlID = "txtTime";
cp.Name = "Started";
cp.Type = TypeCode.DateTime;
sds.InsertParameters.Add(cp);
cp.ControlID = "txtStatus";
cp.Name = "TheStatus";
cp.Type = TypeCode.String;
sds.InsertParameters.Add(cp);
sds.InsertCommand = "INSERT INTO [Company_Ticket] (Admin, Started, Issue, Company, Status) VALUES (@AdminName, @Started, @Issue, @Company, @TheStatus)";
sds.Insert();
Ok here is the error I get:
The variable name '@TheStatus' has already been declared. Variable names must be unique within a query batch or stored procedure.
Must declare the scalar variable "@AdminName".
I don't get it.. I declare TheStatus only once.. and why do I keep getting this about AdminName?
|
|
|
|
|
You are only instantiating a ControlParameter once. Create a new instance for each parameter -
ControlParameter cp = new ControlParameter();
cp.ControlID = "TextBox2";
cp.Name = "Issue";
cp.Type = TypeCode.String;
sds.InsertParameters.Add(cp);
cp = new ControlParameter();
cp.ControlID = "TextBox1";
cp.Name = "Company";
cp.Type = TypeCode.String;
sds.InsertParameters.Add(cp);
etc...
|
|
|
|
|
WOW I can not believe I didnt notice that.
I have making a v2 for my company for a ticketing software and used the same method in the last one. It worked... because I did use cp = new ControlParameter().
I was combining the two to see if I could figure it out and I over looked that... WOW
Thanks though!
|
|
|
|
|
Hi all,
I have created helptooltip usercontrol and using it on my other controls and pages.
aspx is
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="HelpTooltipButton.ascx.cs" Inherits="Controls.HelpTooltipButton" %>
<asp:ImageButton ID="TooltipButton" runat="server" Height="19px" Width="19px" ImageUrl="~/Images/HelpIcon_sm.gif" />
the code behind is :
protected override void OnPreRender(EventArgs e)
{
this.TooltipButton.TabIndex = 1000;
functionScript = new System.Text.StringBuilder("showPopup('" + Content + "','" + Title + "','" + TooltipButton.ClientID + "');return false;");
TooltipButton.OnClientClick = functionScript.ToString();
TooltipButton.CausesValidation = ButtonValidator;
}
This control is being used in other user controls.
In my main aspx page, I have used multiview control, to use for tabstrip.
when I am on one tab, and if help button is clicked, helptooltip opens.
without closing that tooltip if I move to other tab, the tooltip is still open.
I would like to close that popup when I move from one tab to other.
I tried to use mouseover and mouseout events for the tooltip as:
protected override void OnPreRender(EventArgs e)
{
if ((TEAMAppConstants.m_AppMode == TEAMAppConstants.AppMode.AdminPages) && (TEAMAppConstants.SelectedUseCase == TEAMAppConstants.DASHBOARD_STATUS))
{
return;
}
this.TooltipButton.TabIndex = 1000;
functionScript = new System.Text.StringBuilder("showPopup('" + Content + "','" + Title + "','" + TooltipButton.ClientID + "');return false;");
TooltipButton.Attributes.Add("onmouseover", functionScript.ToString());
TooltipButton.Attributes.Add("onmouseout", "hidePopup('" + TooltipButton.ClientID.ToString() + "');");
TooltipButton.CausesValidation = ButtonValidator;
}
here, onmouseover tooltip opens, but on mouseout I javascript exception as object not found.
can anyone please suggest me, how can I handle onmouseout event to close the already opened tooltip help?
Many thanks.
|
|
|
|
|
Is there a way to create a config file that controls the elements on specific pages. For example I have 2 pages viz. page1.aspx and page2.aspx. I want to have a config file in which I can control the visible property of the textbox controls on both pages.
Something like this:-
<page id = "page1.aspx">
<controls>
<control1 ID = "Textbox1" Visible = "false">
</controls>
</page>
<page id = "page2.aspx">
<controls>
<control1 ID = "Textbox1" Visible = "true">
</controls>
</page>
|
|
|
|
|
Well, you could create an HttpModule that reads the config file, identifies the current page, and injects a Load or PreRender event handler to hide or display controls.
Can I ask why you would want to do this? What's wrong with setting the property on the page?
|
|
|
|
|
I have a need to enter names and addresses throughout a web application. How can I create a control (C#) that I can include in a FormView control that will allow names and addresses to be entered with the fields bound to a datasource via a Formview Template?
|
|
|
|
|
Do a google search and tons of examples are bound to pop up.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
My code is
public void Insert()
{
string query =
"INSERT INTO WordTable (Word_ID,Word,Help) " +
"VALUES (@Word_ID,@Word,@Help)";
SqlConnection conn = new SqlConnection(cs);
SqlCommand cmd = new SqlCommand(query, conn);
cmd.Parameters.Add(new SqlParameter("@Word_ID",this.Word_ID));
cmd.Parameters.Add(new SqlParameter ("@Word",this.word));
cmd.Parameters.Add(new SqlParameter ("@Help",this.Help));
conn.Open();
cmd.ExecuteScalar();
}
And the exception is
System.Data.SqlClient.SqlException was unhandled by user code
Message="String or binary data would be truncated.\r\nThe statement has been terminated."
Source=".Net SqlClient Data Provider"
ErrorCode=-2146232060
Class=16
LineNumber=1
Number=8152
Procedure=""
Server="\\\\.\\pipe\\F52FA45D-C426-4C\\tsql\\query"
State=13
StackTrace:
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteScalar()
at SQLWord.Insert() in e:\asp.net\hangaro\App_Code\SQLWord.cs:line 48
at WordList.AddWord(SQLWord w) in e:\asp.net\hangaro\App_Code\WordList.cs:line 52
at Add_Word.WriteToSQL() in e:\asp.net\hangaro\Add_Word.aspx.cs:line 60
at Add_Word.Add_Click(Object sender, EventArgs e) in e:\asp.net\hangaro\Add_Word.aspx.cs:line 36
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException:
I have checked the values of
this.Word_ID etc...
What shall I do ?
Apurv
|
|
|
|
|
Try executenonquery instead of executescalar.
scalar is for a select statement, it returns the first value of the first row.
I didn't get any requirements for the signature
|
|
|
|
|
I am trying to change a LinkButton to disabled/enabled:
LinkButton newNext = (LinkButton)DataList1.FindControl("NextHyperLink");
newNext.Enabled = !pdDataSource.IsLastPage;
this will not work.. it returns that newNext is null...
The linkbuttons are in the HeadTemplate of the DataList1??
|
|
|
|
|
Problem is seems like where you are calling Find Control.
Datalist contains more that one items so you will need to provide specific item.
Can post here code that in which you are calling ?
Parwej Ahamad
R & D: REST services with WCF
|
|
|
|
|
In which event you are trying to access?
If page load i think you cannot...
Try by accessing in the ItemDataBound event... by using e.Item.FindControl
EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.
|
|
|
|
|
The problem was is I was trying to access a LinkButton that was in a DataList and that DataList was in another DataList... (one datalist was in the Headertemplate of another datalist)
Still wonder how to do that though??
|
|
|
|
|
for(int i=0;i<datalist1.items.count;i++)>
{
LinkButton newNext = (LinkButton)DataList1.Items[i].FindControl("NextHyperLink");
}
now u can find the value of LinkButton Control , may b this hyelps you .
|
|
|
|
|
Hi all
I have a text box, which will take input from user in hr:min:sec format.
I would like to verify:
1. User enters the in correct format,
2. I would like to verify of the values are correct, e.g. for hrs < 24, for mins it should be less than 60 and simillarly for sec should be less than 60.
or is there any way, that I can set the text box to take user input as hrs:min:sec format. pls guide me. thanks
|
|
|
|
|
Have you looked at the validation controls that are available?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Thanks for reply. I have regular expression validator, but wanted to have the regular expression to check user input in HH:MM:SS format.
I am using, regular expression
^([0-1][0-9]|2[0-3]) 0-5][0-9]) 0-5][0-9])$
|
|
|
|
|
Have you looked at Expresso, here at CP? It is a really great tool for building/testing regular expressions.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Thanks for the information.
I have following regular expression to check HH:MM:SS format of the text box.
^([0-1]?[0-9]|2[0-3]):([0-5]?[0-9]):([0-5]?[0-9])$
I would like to give the flexibility to the user to enter the data in MM:SS format too. I was trying to modify the above regular expression to validate for the MM:SS format too. but didnt get the success.
can anyone please help me to build the regular expression to allow user to enter data in HH:MM:SS and MM:SS format too.
Thanks a lot.
|
|
|
|
|
Using Visual Studio 2005, when I edit a FormView template it is not presented in WYSIWYG mode, but is reformatted to about half-column size. Is there a trick to being able to edit a template as it will actually look? It looks correct when not in template editing mode.
|
|
|
|
|
VS 2005? Do you use C#, VB, ASP.NET, J#?
Could you be more specific?
|
|
|
|
|
Sorry: C#, VS 2005. When I go into template editing mode the templates are only about half the width of how they display when in non-edit mode. This makes it very hard to get the templates right. The same thing happens with VS 2008.
|
|
|
|
|
can't you use a property like ItemStyleWidth or ControlStyleWidth
|
|
|
|