15,886,199 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by musiw (Top 122 by date)
musiw
8-Jan-14 21:47pm
View
the link did help me give ideas...which is i dont need to use window.print() as it dont cut paper.i use print document(). right now i try to install printer driver to sever then goint to configure it to print to local user's pc... any suggestion??
musiw
7-Jan-14 6:46am
View
because printer type EPSON TM-L90 Receipt consider 5 tickets as a 1 page.it doesnt cut the ticket 1 by 1.no matter how i break the page it does nothing.
i try to add separator to repeater(table to display ticket) and print it out from normal A4 printer it works nice.but come to this thermal printer it doesnt break the page/repeater.
musiw
7-Jan-14 2:04am
View
i want to print tickets.currently i able to print ticket.but only one ticket at a time.lets say i want to print ticket for 5persons the thermal printer (EPSON receipt printer) will print it out in a long page.i already do the page break but nothing happen.
so ive code to print for many tickets but it only implement in windows application....so thats my situation...what else i can do to solve this?
my code to print:-
<script type="text/vbscript">
Sub Print()
'print_ticket.style.visibility="hidden"
OLECMDID_PRINT = 6
OLECMDEXECOPT_DONTPROMPTUSER = 2
OLECMDEXECOPT_PROMPTUSER = 1
call WB.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER,1)
'print_ticket.style.visibility="visible"
'if print_ticket.click = true
'dim status
End Sub
document.write "<object ID='WB' WIDTH=0 HEIGHT=0 CLASSID='CLSID:8856F961-340A-11D0-A96B-00C04FD705A2'></object>"
<body onload="Print();" öncontextmenu="return false">
<object id="WebBrowser1" width="0" height="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"> </object>
the code to bypass print dialog.
musiw
20-Oct-13 11:21am
View
i already put all the control in the update panel.but nothing happen.
musiw
10-Sep-13 3:04am
View
thank you for reply.but i dont understand how to implement the way you suggest..
currently my form is like that.many textbox user will have to key in.they want it to be like that.because each textbox has its own category.just like a table and then fill in.
thanks.
musiw
17-May-13 4:56am
View
it is..but i already tried to print page without dialog.it is failed.so i change the browser to firefox
musiw
8-May-13 0:32am
View
i understand your answer.if u can help me give me any solutions...?my system is need to print tickets.if window.print() all the url at header and footer will be print also.and important thing the ticket must be print 1 by 1 not 5 straightly(if customer buy 5 tickets).the ticket will be long...
musiw
21-Apr-13 21:16pm
View
date will automatically get from the system.the station id also get from system.only the sequence number...how to append and increasing
musiw
17-Apr-13 23:23pm
View
or we save the 5 people data row by row then we can print one by one?i thought the data is stored as in 1 row..because we can see the quantity and the amount collected.only the ticket just one by one
musiw
17-Apr-13 23:19pm
View
i know how to save data to database.but this time is about printing ticket in fact using thermal printer.is it same method to print A4 paper?what about 5 people buy ticket but printer print one by one instead of 1 ticket...please someone guide me
musiw
17-Apr-13 6:27am
View
can you show me how to code for print ticket one by one..?save data i can try to do it...but for the next thing (print) i dont understand how it operate
musiw
17-Apr-13 6:09am
View
i dont code for printing yet because i dont know how.it has to start with the storing all the key in data to db and at the same time print tickets..
musiw
26-Dec-12 6:39am
View
can you give me some code examples?i dont know javascript and all the passing function.thanks
musiw
21-Dec-12 23:33pm
View
no it's not what im looking for.i bind data to gridview using view state data table.then insert to database.so how i want to update datatable and bind it back before i insert into database.
musiw
2-Dec-12 13:30pm
View
the column is not appear.for example column value for remarks is null(because user didnt key in) so when i want to display the column for remarks is blank.i understand but at least it must show the border table
musiw
30-Nov-12 5:30am
View
TQ dominic for asking. i'd just tried my coding.i make some alteration.seems like yours.but i using for loop.
musiw
16-Nov-12 21:03pm
View
Deleted
thank you very much for your time and i'm sorry i dont have money to pay you.
musiw
16-Nov-12 2:00am
View
i already tried..still no success..can you help me..
thanks in advance.
musiw
15-Nov-12 19:51pm
View
Dim cnn As New SqlConnection(connectionString)
cnn.Open()
Dim cmd As New SqlCommand
Dim tran As SqlTransaction = cnn.BeginTransaction()
cmd.Connection = cnn
cmd.Transaction = tran
cmd.CommandText = "Insert into butiran_hantar ([depoh],[siriSA],[kuantiti],[date],[stokereta],[jenisroda], " +
"[nosiri],[saizroda],[flange],[hollow],[tindakan],[skid],[catatan],[status]) " +
"values (@depoh,@siriSA,@kuantiti,@date,@stokereta,@jenisroda, " +
"@nosiri,@saizroda,@flange,@hollow,@tindakan,@skid,@catatan,@status)"
cmd.CommandType = CommandType.Text
cmd.Connection = cnn
Dim n As Integer = Convert.ToInt32(kuantiti.Text)
For i As Integer = 0 To n - 1
'Dim p1 As New SqlParameter("@param1", SqlDbType.Int)
'Dim p2 As New SqlParameter("@param2", SqlDbType.Int)
If i = 0 Then
'p1.Value = Convert.ToInt32(textBox1.Text.Trim())
' row 1 in database
' row 1 in database
'p2.Value = Convert.ToInt32(textBox2.Text.Trim())
cmd.Parameters.AddWithValue("@depoh", depohlist.SelectedValue)
cmd.Parameters.AddWithValue("@siriSA", Convert.ToInt32(lblsiri.Text))
cmd.Parameters.AddWithValue("@kuantiti", Convert.ToInt32(kuantiti.Text))
cmd.Parameters.AddWithValue("@date", tarikh.Text)
cmd.Parameters.AddWithValue("@stokereta", stokereta.Text)
cmd.Parameters.AddWithValue("@jenisroda", ddl_jenisroda.SelectedValue)
cmd.Parameters.AddWithValue("@nosiri", Convert.ToInt32(nosiri.Text))
cmd.Parameters.AddWithValue("@saizroda", Convert.ToInt32(saizroda.Text))
cmd.Parameters.AddWithValue("@flange", Convert.ToInt32(flange.Text))
cmd.Parameters.AddWithValue("@hollow", Convert.ToInt32(hollow.Text))
cmd.Parameters.AddWithValue("@tindakan", ddl_tindakan.SelectedValue)
cmd.Parameters.AddWithValue("@skid", ddl_skid.SelectedValue)
cmd.Parameters.AddWithValue("@catatan", catatan.Text)
cmd.Parameters.AddWithValue("@status", "Proses")
Else
cmd.Parameters.AddWithValue("@depoh", depohlist.SelectedValue)
cmd.Parameters.AddWithValue("@siriSA", Convert.ToInt32(lblsiri.Text))
cmd.Parameters.AddWithValue("@kuantiti", Convert.ToInt32(kuantiti.Text))
cmd.Parameters.AddWithValue("@date", tarikh.Text)
cmd.Parameters.AddWithValue("@stokereta", stokereta.Text)
cmd.Parameters.AddWithValue("@jenisroda", ddl_jenisroda.SelectedValue)
cmd.Parameters.AddWithValue("@nosiri", Convert.ToInt32(nosiri.Text))
cmd.Parameters.AddWithValue("@saizroda", Convert.ToInt32(saizroda.Text))
cmd.Parameters.AddWithValue("@flange", Convert.ToInt32(flange.Text))
cmd.Parameters.AddWithValue("@hollow", Convert.ToInt32(hollow.Text))
cmd.Parameters.AddWithValue("@tindakan", ddl_tindakan.SelectedValue)
cmd.Parameters.AddWithValue("@skid", ddl_skid.SelectedValue)
cmd.Parameters.AddWithValue("@catatan", catatan.Text)
cmd.Parameters.AddWithValue("@status", "Proses")
End If
'cmd.Parameters.Add(p1)
'cmd.Parameters.Add(p2)
' Execute the query
cmd.ExecuteNonQuery()
Next
my aspx code is already pasted above.i have a form where user can add row if they want.in 1 row i have multiple textboxes and dropdown.
musiw
15-Nov-12 5:42am
View
i already did using for loop..everytime i enter the data..lets say 2 rows of data..it kept get the two rows data..then it cannot store in database..i dont kno how..if u can show me with code it will be helpful..
thanks
musiw
14-Nov-12 4:13am
View
how to store multiple values to multiple row..??currently my code seems to store in a single row in sql
musiw
22-Oct-12 2:52am
View
i already tried your link still no success... :( i dont know how to solve this..
musiw
15-Oct-12 10:34am
View
in logs table, there is column for roles..master,manager,general.the rest is user. whenever i login (try multiple emplid with different roles)it is not working..i can tell by looking at the menu. i write xml file menu which approval.aspx only for master,general.the rest of the menu for all.currently my menu only appear for user role.menu master didnt appear
musiw
25-Sep-12 13:50pm
View
code behind:
cmd.Parameters.AddWithValue("@start_date", date3.Text)
cmd.Parameters.AddWithValue("@due_date", date4.Text)
cmd.ExecuteNonQuery()
code aspx:
<tr>
<td>
<asp:TextBox ID = "date3" runat="server" Font-Names="Arial" autocomplete="off" > <asp:Label ID="Label37" runat="server" ForeColor="Red"
Text="* ">
<asp:CalendarExtender ID="CalendarExtender1" runat="server" Enabled="True" TargetControlID="date3" DaysModeTitleFormat="MMMM, yyyy" StartDate="01/01/2012" Format="dd/MM/yyyy" TodaysDateFormat="dd/MM/yyyy">
<asp:Label ID="Label30" runat="server" Font-Names="Arial"
ForeColor="Red">
</td>
</tr>
<tr>
<td class="style4">
<asp:Label ID="Label21" runat="server" Font-Names="Arial"
Text="End Date:">
</td>
<td>
<asp:TextBox ID = "date4" runat="server" Font-Names="Arial"
> <asp:Label ID="Label38" runat="server" ForeColor="Red"
Text="* ">
<asp:CalendarExtender ID="CalendarExtender2" runat="server" Enabled="True" TargetControlID="date4" DaysModeTitleFormat="MMMM, yyyy" StartDate="01/01/2012" OnClientDateSelectionChanged="ValidateDate" Format="dd/MM/yyyy" TodaysDateFormat="dd/MM/yyyy">
<asp:Label ID="Label31" runat="server" Font-Names="Arial"
ForeColor="Red">
</td>
</tr>
musiw
25-Sep-12 12:40pm
View
it's not working.i already mentioned above, i tried to change the format.the error still appear.
musiw
13-Sep-12 23:44pm
View
web application
musiw
15-Aug-12 1:07am
View
how?i dont understand.can you explain further.thanks
<asp:Repeater ID="Repeater1" runat="server" OnDataBinding="Repeater1_OnItemDataBound" >
<HeaderTemplate>
<table width="100%">
<tr bgcolor="#b0c4de">
<th>
<asp:LinkButton ID="Button2" runat="server" Text="Update" />
</th>
<th>Tajuk Projek</th>
<th>Nama</th>
<th>Tujuan</th>
<th>Tarikh Permohonan</th>
</tr>
</HeaderTemplate>
<itemtemplate>
<tr bgcolor="#f0f0f0">
<td>
<asp:CheckBox ID="CheckBox1" runat="server" />
</td>
<td>
<asp:Label ID="Label7" runat="server" Text='<%#Eval("title") %>'></td>
<td>
<asp:Label ID="Label8" runat="server" Text='<%#Eval("nama") %>'></td>
<td>
<asp:Label ID="Label9" runat="server" Text='<%#Eval("tujuan") %>'></td>
<td>
<asp:Label ID="Label10" runat="server" Text='<%#Eval("date_request", "{0:d}") %>'></td>
</tr>
<footertemplate>
</table>
musiw
13-Aug-12 23:53pm
View
sorry for the late reply.lets say when i delete task from table.then it will run delete trigger right.ok then when i look at task_audit table, the data that has been deleted before display null, but in audit_action column display 'DELETE trigger fired' means the task is successfully deleted.ok fine.but is it suppose the deleted data insert into audit table?so that we know which task is deleted.
musiw
9-Aug-12 3:08am
View
after i try trigger for delete..it is not like the example.from example it is shows data still there in audit table.but mine it shows null in audit table
musiw
9-Aug-12 2:35am
View
sorry..after couple of try, it works..hehe..i just build testing table.for real one i need to explore the code more.thanks!
musiw
9-Aug-12 2:27am
View
i tried your solution. first i insert values then when i run trigger, i check audit table no data display.am i missing somewhere
insert into task_status (title_task,pic,start_date,due_date,status_remarks) values('fgh','aku',getdate(),getdate(),'la')
CREATE TRIGGER trgAfterInsert ON [dbo].[task_status]
FOR INSERT
AS
declare @ID int;
declare @task varchar(1000);
declare @status varchar(1000);
declare @audit_action varchar(100);
select @ID=i.id from inserted i;
select @task=i.title_task from inserted i;
select @status=i.status_remarks from inserted i;
set @audit_action='Inserted Record -- After Insert Trigger.';
insert into task_status_audit
(id,title_task,status_remarks,audit_action,audit_date)
values(@ID,@task,@status,@audit_action,getdate());
PRINT 'AFTER INSERT trigger fired.'
GO
musiw
26-Jul-12 21:43pm
View
sorry for your time.im lost.i myself not aware what is the problem.i tried different way.
musiw
26-Jul-12 21:15pm
View
but the value of nickname depend on user select in listbox.how can i get that column since it is not bind to listbox
musiw
26-Jul-12 21:06pm
View
i dont know how to insert nickname(column in table login_staff same table with Nama) Nama is column that i bind to listbox.how can i insert nickname also. the nickname and Nama is going to be insert into task_status table.
musiw
25-Jul-12 20:39pm
View
i already try.but nothing display.no error.1 thing problem i look in database getdate() is stored as in format '2012/07/26'.i changed query into date like '%26/07/2012%' nothing display.
musiw
25-Jul-12 20:23pm
View
i got this error:
An aggregate may not appear in the WHERE clause unless it is in a subquery contained in a HAVING clause or a select list, and the column being aggregated is an outer reference.
musiw
25-Jul-12 4:01am
View
i dont get it.can u explain how to implement it?
musiw
25-Jul-12 2:30am
View
yes its true.i manage to find it myself.i late to open your answer.thanks anyway! if you dont mind.. why is it this happen?i dont understand
musiw
25-Jul-12 2:28am
View
tq rajesh
musiw
22-Jul-12 23:46pm
View
pls guide me on creating a login page using roles auhenticate.i already try bu so many problem arise so i dont know where to start.
musiw
22-Jul-12 17:41pm
View
i already try.but no luck. it seems like when i remove the roles=com.executescalar.to string...then it works.but if its there the problem rise. i dont know whats the problem with my code at the roles part.
basically i want to create login with roles
musiw
22-Jul-12 11:40am
View
no error.it just calendar extender didnt appear.i dont know whats wrong with my login page.after i login the home page which has textbox to insert date from calendar extender(ajax toolkit) didnt appear.didnt show up.
but the textbox which i bind to gridview working fine.the calendar extender is show up when i click the textbox to insert a date.
musiw
22-Jul-12 2:56am
View
home.aspx
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
<asp:Panel ID="Panel2" runat="server" Width="95%">
<table class="style1">
<tr>
<td class="style4">
<asp:Label ID="Label18" runat="server" Font-Names="Arial" Font-Size="Medium"
Text="Task:">
</td>
<td>
<asp:TextBox ID="TextBox1" runat="server" Width="80%" Font-Names="Arial"
Font-Size="Small">
</td>
</tr>
<tr>
<td class="style4">
<asp:Label ID="Label19" runat="server" Font-Names="Arial" Font-Size="Medium"
Text="PIC (Person in charge):" >
</td>
<td>
<asp:ListBox ID="ListBox1" runat="server" Width="80%" SelectionMode="Multiple">
<asp:Label ID="Label26" runat="server" Font-Names="Arial" Font-Size="Small"
Text="Press Ctrl to select multiple">
</td>
</tr>
<tr>
<td class="style4">
<asp:Label ID="Label20" runat="server" Font-Names="Arial" Font-Size="Medium"
Text="Start Date:" >
</td>
<td align="left">
<asp:TextBox ID="TextBox3" runat="server" Font-Names="Arial" Font-Size="Small" >
<asp:CalendarExtender ID="TextBox3_CalendarExtender" runat="server"
Enabled="True" Format="dd/MM/yyyy" PopupPosition="Right"
TargetControlID="TextBox3">
</td>
</tr>
<tr>
<td class="style4">
<asp:Label ID="Label21" runat="server" Font-Names="Arial" Font-Size="Medium"
Text="End Date:">
</td>
<td align="left">
<asp:TextBox ID="TextBox4" runat="server" Font-Names="Arial" Font-Size="Small" >
<asp:CalendarExtender ID="TextBox4_CalendarExtender" runat="server"
Enabled="True" Format="dd/MM/yyyy" TargetControlID="TextBox4">
</td>
</tr>
<tr>
<td class="style4">
<asp:Label ID="Label22" runat="server" Font-Names="Arial" Font-Size="Medium"
Text="Status/Remarks:">
</td>
<td>
<asp:TextBox ID="TextBox5" runat="server" TextMode="MultiLine" Width="80%"
Font-Names="Arial" Font-Size="Small" Height="100px">
</td>
</tr>
<tr>
<td class="style4">
</td>
<td align="left">
<asp:Label ID="Label13" runat="server" ForeColor="
musiw
22-Jul-12 2:54am
View
login page code behind
protected void Button1_Click(object sender, EventArgs e)
{
// Initialize FormsAuthentication, for what it's worth
FormsAuthentication.Initialize();
// Create our connection and command objects
SqlConnection myConnection = new SqlConnection(connectionString);
string sql = "SELECT roles FROM users where empid = '" + empid.Text + "' and pwd = '" + pwd.Text + "'";
SqlCommand cmd = new SqlCommand(sql, myConnection);
SqlDataAdapter adp = new SqlDataAdapter(sql, myConnection);
DataTable ds = new DataTable();
adp.Fill(ds);
// Fill our parameters
cmd.Parameters.AddWithValue("@empid", empid.Text);
cmd.Parameters.AddWithValue("@pwd", pwd.Text);
// Execute the command
myConnection.Open();
SqlDataReader reader = cmd.ExecuteReader();
if (reader.HasRows)
{
while (reader.Read())
{
// Create a new ticket used for authentication
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
1, // Ticket version
empid.Text, // Username associated with ticket
DateTime.Now, // Date/time issued
DateTime.Now.AddMinutes(30), // Date/time to expire
true, // "true" for a persistent user cookie
reader.GetString(0), // User-data, in this case the roles
FormsAuthentication.FormsCookiePath);// Path cookie valid for
}
}
else
{
// Never tell the user if just the username is password is incorrect.
// That just gives them a place to start, once they've found one or
// the other is correct!
lblerror.Text = "Username / password incorrect. Please try again.";
//lblerror.Visible = true;
}
reader.Close();
string roles;
roles = cmd.ExecuteScalar().ToString();
//label_role.Text = roles;
if (ds.Rows.Count != 0)
{
Session["username"] = empid.Text;
if (roles == "admin,user")
{
Server.Transfer("Home.aspx");
}
//else if (roles == "manager,user")
//{
//Server.Transfer("Manager/Home.aspx");
//}
else
{
Server.Transfer("Insert.aspx"); //("~/User/userHome.aspx");
}
}
myConnection.Close();
}
musiw
22-Jul-12 2:38am
View
Deleted
home.aspx
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
<asp:Panel ID="Panel2" runat="server" Width="95%">
<table class="style1">
<tr>
<td class="style4">
<asp:Label ID="Label18" runat="server" Font-Names="Arial" Font-Size="Medium"
Text="Task:">
</td>
<td>
<asp:TextBox ID="TextBox1" runat="server" Width="80%" Font-Names="Arial"
Font-Size="Small">
</td>
</tr>
<tr>
<td class="style4">
<asp:Label ID="Label19" runat="server" Font-Names="Arial" Font-Size="Medium"
Text="PIC (Person in charge):" >
</td>
<td>
<asp:ListBox ID="ListBox1" runat="server" Width="80%" SelectionMode="Multiple">
<asp:Label ID="Label26" runat="server" Font-Names="Arial" Font-Size="Small"
Text="Press Ctrl to select multiple">
</td>
</tr>
<tr>
<td class="style4">
<asp:Label ID="Label20" runat="server" Font-Names="Arial" Font-Size="Medium"
Text="Start Date:" >
</td>
<td align="left">
<asp:TextBox ID="TextBox3" runat="server" Font-Names="Arial" Font-Size="Small" >
<asp:CalendarExtender ID="TextBox3_CalendarExtender" runat="server"
Enabled="True" Format="dd/MM/yyyy" PopupPosition="Right"
TargetControlID="TextBox3">
</td>
</tr>
<tr>
<td class="style4">
<asp:Label ID="Label21" runat="server" Font-Names="Arial" Font-Size="Medium"
Text="End Date:">
</td>
<td align="left">
<asp:TextBox ID="TextBox4" runat="server" Font-Names="Arial" Font-Size="Small" >
<asp:CalendarExtender ID="TextBox4_CalendarExtender" runat="server"
Enabled="True" Format="dd/MM/yyyy" TargetControlID="TextBox4">
</td>
</tr>
<tr>
<td class="style4">
<asp:Label ID="Label22" runat="server" Font-Names="Arial" Font-Size="Medium"
Text="Status/Remarks:">
</td>
<td>
<asp:TextBox ID="TextBox5" runat="server" TextMode="MultiLine" Width="80%"
Font-Names="Arial" Font-Size="Small" Height="100px">
</td>
</tr>
<tr>
<td class="style4">
</td>
<td align="left">
<asp:Label ID="Label13" runat="server" ForeColor="
musiw
21-Jul-12 5:00am
View
thanx kaushik.
musiw
17-Jul-12 21:39pm
View
cannot.i already tried.i also try select @@identity, also cannot. it display all the data from table.i just want the data that last inserted.lets say user insert 2 records into table, then i want gridview display 2 records.
musiw
16-Jul-12 3:31am
View
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource2">
<columns>
<asp:BoundField DataField="nama_barang" HeaderText="nama_barang"
SortExpression="nama_barang" />
<asp:BoundField DataField="bilangan" HeaderText="bilangan"
SortExpression="bilangan" />
<asp:BoundField DataField="stock_last" HeaderText="stock_last"
SortExpression="stock_last" />
<br />
<br />
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:connectionString %>"
SelectCommand="SELECT [nama_barang], [bilangan], [stock_last] FROM [approval]">
protected void Button3_Click(object sender, EventArgs e)
{
SqlConnection cn0 = new SqlConnection(connectionString);
cn0.Open();
int last = int.Parse(Label3.Text);
int req = int.Parse(TextBox7.Text);
int kuantiti = last - req;
string s = "update stocks set stock_left = @stock_left where id_ = '" + ddl1.SelectedIndex + "'";
SqlCommand cd = new SqlCommand(s, cn0);
cd.Parameters.Add("@stock_left", SqlDbType.Int).Value = kuantiti;
string l = "insert into approval (item, quantity, stock_last) values (@item, @quantity, @stock_last)";
SqlCommand c = new SqlCommand(l, cn0);
c.Parameters.Add("@item", SqlDbType.VarChar).Value = ddl1.SelectedItem.Text.Trim();
c.Parameters.Add("@quantity", SqlDbType.Int).Value = TextBox7.Text.Trim();
c.Parameters.Add("@stock_last", SqlDbType.Int).Value = kuantiti;
cd.ExecuteNonQuery();
c.ExecuteNonQuery();
}
protected void ddl1_SelectedIndexChanged(object sender, EventArgs e)
{
SqlConnection cn = new SqlConnection(connectionString);
cn.Open();
string sql = "select stock_left from stocks where nama_barang = '"+ ddl1.SelectedItem.Text +"' ";
SqlCommand c = new SqlCommand(sql, cn);
SqlDataReader dr = c.ExecuteReader();
dr.Read();
if (Convert.ToInt32(dr[0]) > 0)
{
Label3.Text = Convert.ToString(dr[0]);
}
else
{
Label3.Text = "No stock!";
Label3.ForeColor = System.Drawing.Color.Red;
}
}
protected void Button5_Click(object sender, EventArgs e)
{
GridView1.Visible = true;
}
musiw
13-Jul-12 4:25am
View
Deleted
tq.i dont need that.
musiw
13-Jul-12 4:25am
View
tq for reply.i dont know how to pass to popup window.i manage to build form and display all the dropdown list item and the quantity.the problem stuck on the popup window and to pass value
musiw
12-Jul-12 12:05pm
View
yes.user will enter their codename then click submit button.and then the gridview will display data.
musiw
12-Jul-12 3:51am
View
i already create table for user.now, when user 'zmr' or 'wti' enter their nickname then it should display like the table above.especially the column pic; it should display wti,zmr.right now the table doesnt appear at all
musiw
9-Jul-12 4:22am
View
DateTime endDate = DateTime.Parse(TextBox4_CalendarExtender.SelectedDate.ToString());
DateTime startDate = DateTime.Parse(TextBox3_CalendarExtender.SelectedDate.ToString());
TimeSpan diff = endDate - startDate;
double daysBetween = diff.TotalDays;
Label13.Text = daysBetween.ToString();
error appear - >> String was not recognized as a valid DateTime.
musiw
9-Jul-12 3:45am
View
ok.i already try your code.but it calculate wrong answer. let say i pick from 7/4/2012 end 7/10/2012 it become 183. i just want diff on days not month and year.
musiw
9-Jul-12 2:02am
View
i dont know how to code it.lets say if i want to know the diff between start date and due date.how to code it?especially when im using ajax calendar extender.
musiw
13-Jun-12 0:22am
View
done.i already done that line.it works. but 1 more thing, how to export multiple gridview to pdf.the code only convert 1 gridview
musiw
12-Jun-12 22:41pm
View
this is the code:
SqlConnection myConnection = new SqlConnection(connectionString);
SqlCommand Command = new SqlCommand();
Command.CommandText = "select origin,report,react_delay as 'reactionary delay',responsibility,actions from signals_comm_failure where date = '" + TextBox1.Text + "' and id_class=1";
Command.Connection = myConnection;
using (SqlDataAdapter da = new SqlDataAdapter(Command))
{
DataTable dt = new DataTable();
da.Fill(dt);
gd_dt.DataSource = dt;
}
Spire.DataExport.PDF.PDFExport PDFExport = new Spire.DataExport.PDF.PDFExport();
PDFExport.DataSource = Spire.DataExport.Common.ExportSource.DataTable;
PDFExport.DataTable = this.gd_dt.DataSource as DataTable;
PDFExport.ActionAfterExport = Spire.DataExport.Common.ActionType.OpenView;
PDFExport.SaveToFile("Report.pdf");
i want it to display in landscape page format.and 1 more thing; actually i have multiple gridview in multiple tab container.how can i export that multiple gridview into pdf?
the code that spire give only for 1 gridview.really hope that you can help me.
musiw
12-Jun-12 22:02pm
View
im using spire.i get from the link you gave. btw you know how to export datatable to landscape page in pdf?? right now im able to export it to pdf.but its not full.my gridview is long.in pdf it seem like it is half cut
musiw
12-Jun-12 5:05am
View
the error is:the document has no page at line pdf.close(); i dont understand why
musiw
11-Jun-12 5:29am
View
pdfDoc.close();
musiw
2-Jun-12 0:26am
View
i already try your solution, rewritepath("page.aspx"); but after i login the login page appear 2 times.i have to login again
musiw
31-May-12 3:03am
View
no.im not using updatepanel.
musiw
31-May-12 2:48am
View
the contentplaceholder is in the master page.then the other page will follow the master' content.im using vs2010.
musiw
31-May-12 1:55am
View
my web page is using contentplaceholder.which has site master and the file css in there.
musiw
31-May-12 1:19am
View
i already try your solution, but the error still appear.it seems like fileupload.hasfile return false. how to solve this problem??
musiw
30-May-12 7:05am
View
i want to upload a file not data in excel file.it is a report file actually.i want to store in server then user can download the report file.
musiw
14-Feb-12 3:21am
View
hi rahul...
i just want to know if any idea from you regarding to this problem..im sorry for the uncovenience
musiw
2-Feb-12 19:54pm
View
i guess we can create the formula.because it is the total of the available set on that day.(2+5+15=22).for the row KPI, i dont know how they identify it.maybe it is a index that they set to achieve perfomance on that day.they just set to 40.hybrid is only available for 2
for the 2nd table emu set is the total of available set (81,82,83) hybrid is 2.as far as i know hybrid is always 2.because there is only 2 hybrid coach.(active=2)
musiw
1-Feb-12 19:52pm
View
actually i had design it.halfway..but i dont really understand how the data will be stored.im not sure if the table is good enough to store the data and to display back later.i need your help..
musiw
31-Jan-12 23:34pm
View
as far as i understand what user told me, its not fixed.user will key in the total available set that has been used from 3pm till 6am next day.
musiw
31-Jan-12 4:29am
View
sorry rahul..
this is the first table:
class 81 82 83 Hybrid
active 14 21 18 2
avail. 2 5 15 2
Total as
@0600 hrs 2/1/2011 22 2
KPI 40 2
the second table is:
Avail @1500 1/1/2012
Emu Set Hybrid
22 2
-> the second table is the data for the day before that user key in.
-> available emu set and hybrid @3 pm on 1/1/2012
-> 81,82,83,hybrid is class of EMU.
-> active is fix.it is total emu we have in service.
-> avail is how much available emu is for that day.
-> total as at 6 am on the day report is key in
-> KPI is some sort of target perfomance..and it is fix.
hope u can help me how to figure out this table.i dont understand how to create the databse for this kind of data.
thanks in advance.
musiw
31-Jan-12 4:11am
View
its ok i ask someone else.nway thanks for your answer yesterday.
musiw
30-Jan-12 21:02pm
View
hi rahul,
can you help me on this.i really dont understand how to display this table and to build its database for this data.
this is hard copy report.do you have any idea how to implement it.or maybe make some modification/split table since the table is seems very complex..
class 81 82 83 Hybrid Avail @1500 1/1/2011
active 14 21 18 2 EMU Set Hybrid
avail. 2 5 15 2 22 2
Total as @0600 hrs 2/1/2011 22 2
KPI 40 2
fyi:
class:81,82,83 is EMU set
user key in available set for the day and the day before.
musiw
30-Jan-12 5:29am
View
i dont understand..can you show me the code.i already try that but it display not in correct way..
for instance if column [5] has 0 value it display any value.
SqlConnection myConnection = new SqlConnection(connectionString);
DataTable tbl = new DataTable("locomotive");
myConnection.Open();
string cmd2 = "Select avail,f_t,derated,shunting_feeder,pe,overhaul,repair from locomotive where id_class_loco = '" + ddlclass.SelectedIndex + "' and date = '" + TextBox1.Text + "' ";
SqlDataAdapter Ad = new SqlDataAdapter(cmd2, myConnection);
Ad.Fill(tbl);
//if (tbl.Rows.Count > 0)
//{
for (int r = 0; r < tbl.Rows.Count; r++)
{
avail.Text = tbl.Rows[r]["avail"].ToString();
ft.Text = tbl.Rows[r]["F_T"].ToString();
derated.Text = tbl.Rows[r]["derated"].ToString();
sf.Text = tbl.Rows[r]["shunting_feeder"].ToString();
pe.Text = tbl.Rows[r]["pe"].ToString();
overhaul.Text = tbl.Rows[r]["overhaul"].ToString();
repair.Text = tbl.Rows[r]["repair"].ToString();
}
//}
myConnection.Close();
musiw
30-Jan-12 4:35am
View
thanks!! this code can be implement to other table which has total at below...
musiw
30-Jan-12 3:39am
View
hi,
sorry to ask again..how to do it if i want to display in multiple texbox..?
it appear nothing in texbox.seem like no data is bind there
musiw
30-Jan-12 2:19am
View
Deleted
i manage to figure out what the problem.sorry for that question.nway thanks
musiw
30-Jan-12 2:13am
View
Deleted
i think your code is work.i already try that.no error and i already run with breakpoint..but my problem is, the data doesnt appear.
in my case, i have to select dropdown list first to choose the category,then the data will appear depend on what category is selected.but nothing appear in texbox, in fact the textbox also is not there!
blur...
musiw
27-Jan-12 4:58am
View
emu_avail:
5 1 110 NULL 15/13.64 NULL 0 NULL 2012-01-02 00:00:00.000
6 2 106 NULL 25/23.58 NULL 0 NULL 2012-01-02 00:00:00.000
7 3 37 NULL - NULL 0 NULL 2012-01-02 00:00:00.000
8 NULL NULL 253 NULL 40/15/81 NULL 0 2012-01-02 00:00:00.000
class_emu_sector:
1 Sg Gadut - Rawang - Sg Gadut
2 Bt. Caves - Pel. Klang - Bt. Caves
3 Rawang - Tg. Malim
musiw
27-Jan-12 4:52am
View
USE [OMC]
GO
/****** Object: Table [dbo].[class_emu_sector] Script Date: 01/27/2012 17:45:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[class_emu_sector](
[id_sector] [int] IDENTITY(1,1) NOT NULL,
[emu_sector] [varchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
CONSTRAINT [PK_class_emu_sector] PRIMARY KEY CLUSTERED
(
[id_sector] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
musiw
27-Jan-12 4:51am
View
USE [OMC]
GO
/****** Object: Table [dbo].[emu_avail] Script Date: 01/27/2012 17:42:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[emu_avail](
[id] [bigint] IDENTITY(1,1) NOT NULL,
[id_sector] [int] NULL,
[trips] [int] NULL,
[total_trips] [int] NULL,
[emu_percent] [nchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[total_emu_percent] [nchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[hybrid] [int] NULL,
[total_hybrid] [int] NULL,
[date] [datetime] NULL,
CONSTRAINT [PK_cancel_emu_avail] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
USE [OMC]
GO
ALTER TABLE [dbo].[emu_avail] WITH CHECK ADD CONSTRAINT [FK__cancel_em__id_se__02084FDA] FOREIGN KEY([id_sector])
REFERENCES [dbo].[class_emu_sector] ([id_sector])
GO
ALTER TABLE [dbo].[emu_avail] WITH CHECK ADD CONSTRAINT [FK__cancel_em__id_se__208CD6FA] FOREIGN KEY([id_sector])
REFERENCES [dbo].[class_emu_sector] ([id_sector])
GO
ALTER TABLE [dbo].[emu_avail] WITH CHECK ADD CONSTRAINT [FK__emu_avail__id_se__282DF8C2] FOREIGN KEY([id_sector])
REFERENCES [dbo].[class_emu_sector] ([id_sector])
GO
ALTER TABLE [dbo].[emu_avail] WITH CHECK ADD FOREIGN KEY([id_sector])
REFERENCES [dbo].[class_emu_sector] ([id_sector])
musiw
27-Jan-12 3:42am
View
yes.the below row is the total.
i display it in 2 different gridview.i try to display in 1 gridview but it display beside the columns not the below row
SqlDataAdapter sqlcom15 = new SqlDataAdapter("SELECT ct.emu_sector as 'Sector', t.trips,t.emu_percent,t.hybrid,'Total' as 'Sector' from class_emu_sector ct, emu_avail t where ct.id_sector = t.id_sector and date = '" + TextBox1.Text + "'", myConnection);
DataSet ds15 = new DataSet();
sqlcom15.Fill(ds15);
GridView7.DataSource = ds15.Tables[0].DefaultView;
GridView7.DataBind();
SqlDataAdapter sqlcom20 = new SqlDataAdapter("Select t.total_trips as 'Trips',t.total_emu_percent as 'EMU/(%)',t.total_hybrid as 'Hybrid' from emu_avail t where t.date = '" + TextBox1.Text + "'", myConnection);
DataSet ds20 = new DataSet();
sqlcom20.Fill(ds20);
GridView11.DataSource = ds20.Tables[0].DefaultView;
GridView11.DataBind();
musiw
27-Jan-12 3:26am
View
dbo.Availability EMU
[id][bigint],
[id_sector][int]
[trips][int]
[total_trips][int]
[emu_percent][nchar]
[total_emu_percent][nchar]
[hybrid][int]
[total_hybrid][int]
dbo.emu_sector
[id_sector][int]
[sector][varchar]
and the data is like attached before.
musiw
26-Jan-12 19:53pm
View
Availability EMU
1 1 110 null 15/13.64% null - null 2/1/2012
2 2 106 null 25/23.58% null - null 2/1/2012
3 3 37 null - null - null 2/1/2012
4 null null 253 null 40/15/81% null - 2/1/2012
EMU Sector
1 Sg Gadut - Rawang - Sg Gadut
2 Bt. Caves - Pel.Klang - Bt.Caves
3 Rawang - Tg. Malim
fyi, total trips actually is permanent data.it fix 253 trips.cannot be changed.total_emu_percent & total_hybrid is manually insert by user.i already ask user for the formula but he said no need to put the formula, a staff will key in the total.
musiw
25-Jan-12 21:46pm
View
hi rahul,
i want to display a data which look like this:
Sector Trips EMU/(%) Hybrid
location1 110 15/13.64 -
location2 106 25/23.58 -
location3 37 - -
Total 253 40/15/81 -
i have tried so many times.but the total column appear next to trips,emu & hybrid.i want to display it below.
database:
Availability EMU
id,
id_sector,
trips,
total_trips,
emu_percent,
total_emu_percent,
hybrid,
total_hybrid,
date
EMU Sector
id sector,
emu_sector
fyi, i manage to display all the data except the total data below.is there any way to complete or i have to change the database?
musiw
20-Jan-12 6:24am
View
ok.thank you very much. i already vote your answer :)
musiw
20-Jan-12 5:35am
View
ohh..it just some small mistake in my query i guess..but anyway thanks a lot!
lets say if i want to add some more row, just append sql query and union all for how many rows that i want..is that right?
musiw
20-Jan-12 4:55am
View
if u can share it will be better.so that i can compare
musiw
20-Jan-12 4:19am
View
sorry to ask you...i dont get it.just add another gridview then put this query.where to put the 1st gridview?this query is for both right? i just copy your code.but it display nothing
musiw
20-Jan-12 3:33am
View
what is stringbuilder? is there any namespace i have to add?because it gor error
musiw
19-Jan-12 20:07pm
View
ok then..at least i know it is possible..can u show me how to done that.because i manage to do it in 2 different gridview only not one gridview
musiw
19-Jan-12 4:18am
View
i already try that.i manage to display in 2 different gridview.but according to a hard copy report the data is display in 1 table.fyi, this is report department which is key in data manually.never have a system before.this is the first system for that.
i also try to display it vertically.
cancellation|delay|EMU|Security|Others
i just want to ask you.is there a possible way to create this report in 1 table as i ask earlier?if it impossible then i have to standby with the answer to user later.. :)
musiw
19-Jan-12 3:20am
View
you mean display in two different gridview?
dbo.Cancellation
[id][bigint],
[id_class_service][int]
[cancellation][int]
[delay][int]
[date][datetime]
dbo.class_service
[id_class_service][int]
[desc_]
[cancellation]
1 1 0 0 2/1/2012
2 2 0 49 2/1/2012
3 3 0 9 2/1/2012
[class_service]
1 EMU
2 Security
3 Others
musiw
18-Jan-12 22:18pm
View
EMU Security Others
Cancellation 0 0 0
Delay (min) 0 49 0
musiw
18-Jan-12 20:40pm
View
its integer.
the table will look like this.
EMU Security Others
Cancellation
Delay (min)
musiw
17-Jan-12 21:56pm
View
hi..
thanks.today i manage to complete another table using your coding given yesterday.but it come to a problem when i want to create another gridview that has 2 rows.yesterday only 1 row (no.of train)...
so how to add another row below.can u explain..
thanks in advance.
musiw
17-Jan-12 5:27am
View
i'm from malaysia. thanks again.. if anything i refer to you.hope you dont get bored later...
musiw
17-Jan-12 2:43am
View
oh great!! it works! THANKS A LOT Rahul! you really save my job... haha :D how come you think the query.im not really clever in database query.if you dont mind where can i learn it further more.
musiw
17-Jan-12 1:47am
View
ok.that's better.. :D but where i must put the query "where date = 2/1/2012".because the data(report) will display according to the condition which is date.i just append but it show invalid column name date...
and 1 more thing..i must label the row data.it cant be 1 0 without any label.
currently it shows
EMU Intercity
1 0
i want to label it
EMU Intercity
no. of train 1 0
i have to follow the rule.its user requirement.what to do...
musiw
16-Jan-12 20:18pm
View
i just copy your code then the error appear.i remove the @ sign before because it also give error.this error below is a fter i remove the @ sign.
Could not determine a MetaTable. A MetaTable could not be determined for the data source '' and one could not be inferred from the request URL. Make sure that the table is mapped to the dats source, or that the data source is configured with a valid context type and table name, or that the request is part of a registered DynamicDataRoute.
this is the source code design:
<asp:GridView ID="gd_transshipment" runat="server"
ShowHeaderWhenEmpty="True"
AutoGenerateColumns="False" Font-Size="Small" ForeColor="Black">
<columns>
<asp:TemplateField>
<itemtemplate>
<asp:Label ID = "Label1" runat="server" Text="No. of trains">
<asp:TemplateField HeaderText="EMU">
<itemtemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Eval("no_of_train") %>'>
<asp:TemplateField HeaderText="Intercity">
<itemtemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Eval("no_of_train") %>'>
i dont know how to create a row in gridview..
musiw
16-Jan-12 4:55am
View
i dont use stored procedure.i just using query as usual..is it possible?cause i dont familiar using stored procedure.but if you think it is the best way, hope u can show me the code later.
musiw
16-Jan-12 3:36am
View
my database:
table transshipment:
id
id_transshipment
no_of_train
date
table class_transshipment:
id_transshipment
desc_
id_transshipment= 1
desc_ =EMU
id_transshipment= 2
desc_ =intercity
eg: EMU Intercity
no.of trains Data Data
i want to display the data from transshipment table in row and column format.
eg:
musiw
15-Jan-12 23:18pm
View
this is the code:
c# code:
SqlDataAdapter sqlcom0 = new SqlDataAdapter("select no_of_train from transshipment where id_transshipment in (1,2)", myConnection);
DataSet ds0 = new DataSet();
sqlcom0.Fill(ds0, "transshipment");
gd_transshipment.DataSource = ds0.Tables["transshipment"].DefaultView;
gd_transshipment.DataBind();
<asp:GridView ID="gd_transshipment" runat="server"
ShowHeaderWhenEmpty="True"
AutoGenerateColumns="False" Font-Size="Small" ForeColor="Black">
<columns>
<asp:TemplateField>
<itemtemplate>
<asp:Label ID="Label1" Text="No. of trains" runat="server">
<asp:TemplateField HeaderText="EMU">
<itemtemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Eval("no_of_train") %>'>
<asp:TemplateField HeaderText="Intercity">
<itemtemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Eval("no_of_train") %>'>
musiw
12-Jan-12 7:46am
View
EMU | Intercity
No.of trains 1 -
this is actually what i want.only appear 1 row for the data according to date 2/1/2012. EMU/Intercity is a class of train.no of train is actually available train for that day (2/1/2012)
my code is from you. i just copy directly.
musiw
12-Jan-12 4:05am
View
table - transshhipment
id | id_transshipment | no_of_train | date
1 1 1 2/1/2012
2 2 - 2/1/2012
table class_transshipment
id_transshipment | desc_
1 EMU
2 Intercity
i want to display the transshipment data into gridview according by date.when user enter 2/1/2012 then the data will display.
i hope this will make you understand.
musiw
12-Jan-12 3:24am
View
hi rahul,
sorry for the late reply..i just try your code.TQ.something better than me..hehe..but it still dont display exactly i want.
Transshipment
EMU | Intercity
No.of trains 1 1
No.of trains - -
my code display like this:
Transshipment
EMU | Intercity
No.of trains - -
and it should be like this:
Transshipment
EMU | Intercity
No.of trains 1 -
can help me on this?
thanks in advance
musiw
6-Jan-12 4:15am
View
sorry for the question.i already manage to customize it.
but now the problem is i want to bind the data to gridview.there is 2 different data will display in the column.each of data has its own ID in the same table db.how can i bind 2 data which has different ID in the same gridview?i already done that but the second data is display in the both column.seems like gridview bind the last data.
SqlDataAdapter sqlcom0 = new SqlDataAdapter("select no_of_train from transshipment where id_transshipment =1", myConnection);
DataSet ds0 = new DataSet();
sqlcom0.Fill(ds0, "transshipment");
gd_transshipment.DataSource = ds0.Tables["transshipment"].DefaultView;
gd_transshipment.DataBind();
SqlDataAdapter sqlcom10 = new SqlDataAdapter("select no_of_train from transshipment where id_transshipment =2", myConnection);
DataSet ds10 = new DataSet();
sqlcom10.Fill(ds10, "transshipment");
gd_transshipment.DataSource = ds10.Tables["transshipment"].DefaultView;
gd_transshipment.DataBind();
musiw
6-Jan-12 3:23am
View
i try search the code how to create the gridview dynamically.but i found nothing.do you know where i can find it?i dont know how to customize gridview turn to be the one i want..
musiw
5-Jan-12 20:54pm
View
hi patel,
currently im trying to use tab container.hope it will go smooth..
do you know how to create gridview dynamically.the gridview that we usually use is only column that available.this time i want to create a gridview like a table.
example:
Column0 | Column1
Row0 Databound | Databound
Row1 Databound | Databound
is it possible?
musiw
5-Jan-12 0:05am
View
ok..so u are suggesting me using tabcontainer..ok interesting..
but if one of the tab which there is a case gridview is empty because the report is not there..so the tab will appear empty?then user proceed to click next tab which has report..
or any other idea?
musiw
18-Dec-11 1:17am
View
ok.im using query string.but now the problem is when i have to pass long value it doesnt work it.
i try to pass it to Label first.just to see if it pass the value or not..for example the value is "Signals & Communication Failure"..it just appear Signals the rest are gone.
help me pls.thanks
musiw
15-Dec-11 3:37am
View
THANX A LOT HABIB! :D glad you help me..
musiw
14-Dec-11 2:23am
View
i want to update data in two gridviews.
musiw
12-Dec-11 21:40pm
View
hi manish...
i already try your code.it visibles.not dissapear as earlier.but now one problem is....the item in the dropdown turn empty.only the dropdown shows there... hihi
musiw
12-Dec-11 20:46pm
View
Deleted
<%@ Page Title="" Language="C#" MasterPageFile="~/site.master" AutoEventWireup="true" CodeFile="Insert_Data.aspx.cs" Inherits="_Default" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<asp:Content ID="Content2" runat="server"
contentplaceholderid="ContentPlaceHolder1">
<form id="form1" runat="server">
<div class="post">
<div class="post-bgtop">
<div class="post-bgbtm">
Welcome to Operation Management Centre
<p class="title">
Please select category:</p>
<div class="entry">
<p>
<asp:DropDownList ID="ddl1" runat="server" AutoPostBack="True"
onselectedindexchanged="ddl1_SelectedIndexChanged">
<asp:ListItem>Please Select
<asp:ListItem>Signals & Communication Failure
<asp:ListItem>Failure
<asp:ListItem>Coach & Wagon Defect
</p>
<p>
<asp:DropDownList ID="ddl2" runat="server" AutoPostBack="True"
onselectedindexchanged="ddl2_SelectedIndexChanged" Visible="False">
</p>
<p>
<asp:Panel ID="Panel1" runat="server" Visible="False"
BorderColor="#336699" BorderWidth="1px">
<table class="style1">
<tr>
<td class="style1">
<asp:Label ID="Label8" runat="server" Text="Origin:">
</td>
<td class="style1">
<asp:DropDownList ID="origin1_list" runat="server"
DataSourceID="SqlDataSource1" DataTextField="LCN_NAME"
DataValueField="LCN_NAME" AppendDataBoundItems="true">
<asp:ListItem>--Please Select--
<asp:TextBox ID="origin1Text" runat="server" Visible="False">
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>"
ProviderName="<%$ ConnectionStrings:ConnectionString2.ProviderName %>"
SelectCommand="SELECT "LCN_NAME" FROM "T_LOCATION"">
</td>
</tr>
<tr>
<td class="style9">
<asp:Label ID="Label9" runat="server" Text="Destination:">
</td>
<td>
<asp:DropDownList ID="dest1_list" runat="server"
DataSourceID="SqlDataSource1" DataTextField="LCN_NAME"
DataValueField="LCN_NAME" AppendDataBoundItems="true">
<asp:ListItem>--Please Select--
<asp:TextBox ID="dest1Text" runat="server" Visible="False">
musiw
12-Dec-11 20:45pm
View
protected void Page_Load(object sender, EventArgs e)
{
ddl2.Visible = false;
Panel1.Visible = false;
if (!IsPostBack)
{
ddl2.Items.Clear();
}
}
protected void ddl1_SelectedIndexChanged(object sender, EventArgs e)
{
if (ddl1.SelectedIndex == 1)
{
ListItem item;
item = new ListItem("Please Select", "Please Select");
ddl2.Items.Add(item);
item = new ListItem("KVDT & RIDT", "KVDT & RIDT");
ddl2.Items.Add(item);
item = new ListItem("Outside DT", "Outside DT");
ddl2.Items.Add(item);
ddl2.Visible = true;
}
if (ddl1.SelectedIndex == 2)
{
ListItem item;
item = new ListItem("Please Select", "Please Select");
ddl2.Items.Add(item);
item = new ListItem("ETS/EMU", "ETS/EMU");
ddl2.Items.Add(item);
item = new ListItem("Locomotive", "Locomotive");
ddl2.Items.Add(item);
ddl2.Visible = true;
}
}
protected void ddl2_SelectedIndexChanged(object sender, EventArgs e)
{
Panel1.Visible = true;
}
musiw
12-Dec-11 3:25am
View
i change the properties of radiobuttonlist: autopostback to true.it works.it show the panel form that i want. but i must put 'if (RadioButtonList1.SelectedIndex == -1)' or else i get error out of index range.
but after the click the radiobutton dissapear whenever the panel is show..
here the code behind:
if (ddl1.SelectedIndex == 1)
{
RadioButtonList1.Visible = true;
ListItem[] item = new ListItem[2];
item[0] = new ListItem("KVDT & RIDT", "KVDT & RIDT");
RadioButtonList1.Items.Add(item[0]);
item[1] = new ListItem("Outside DT", "Outside DT");
RadioButtonList1.Items.Add(item[1]);
}
if (ddl1.SelectedIndex == 2)
{
RadioButtonList1.Visible = true;
ListItem[] item = new ListItem[2];
item[0] = new ListItem("ETS/EMU", "ETS/EMU");
RadioButtonList1.Items.Add(item[0]);
item[1] = new ListItem("Locomotive", "Locomotive");
RadioButtonList1.Items.Add(item[1]);
}
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (RadioButtonList1.SelectedIndex == -1)
{
RadioButtonList1.Visible = true;
Panel1.Visible = true;
}
if (RadioButtonList1.SelectedIndex == 0)
{
RadioButtonList1.Visible = true;
Panel1.Visible = true;
}
}
musiw
12-Dec-11 0:10am
View
i cannot copy all the source code.it eliminates some lines..
i already attached the code behind before..
i hope u understand the code.
thanx..
musiw
11-Dec-11 23:16pm
View
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<asp:Content ID="Content2" runat="server"
contentplaceholderid="ContentPlaceHolder1">
<form id="form1" runat="server">
<div class="post">
<div class="post-bgtop">
<div class="post-bgbtm">
Welcome to Operation Management Centre
<p class="title">
Please select category:</p>
<div class="entry">
<p>
<asp:DropDownList ID="ddl1" runat="server">
<asp:ListItem>Please Select
<asp:ListItem>Signals & Communication Failure
<asp:ListItem>Failure
<asp:ListItem>Coach & Wagon Defect
<asp:Button ID="Button1" runat="server" onclick="Button1_Click1"
Text="Submit" />
</p>
<p>
<asp:RadioButtonList ID="RadioButtonList1" runat="server" OnSelectedIndexChanged = "RadioButtonList1_SelectedIndexChanged">
</p>
<p>
<asp:Panel ID="Panel1" runat="server" Visible="False">
<table class="style1">
<tr>
<td class="style1">
<asp:Label ID="Label8" runat="server" Text="Origin:">
</td>
<td class="style1">
<asp:DropDownList ID="origin1_list" runat="server"
DataSourceID="SqlDataSource1" DataTextField="LCN_NAME"
DataValueField="LCN_NAME" AppendDataBoundItems="true">
<asp:ListItem>--Please Select--
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>"
ProviderName="<%$ ConnectionStrings:ConnectionString2.ProviderName %>"
SelectCommand="SELECT "LCN_NAME" FROM "T_LOCATION"">
<asp:TextBox ID="origin1Text" runat="server" Visible="False">
</td>
</tr>
<tr>
<td class="style9">
<asp:Label ID="Label9" runat="server" Text="Destination:">
</td>
<td>
<asp:DropDownList ID="dest1_list" runat="server"
DataSourceID="SqlDataSource1" DataTextField="LCN_NAME"
DataValueField="LCN_NAME" AppendDataBoundItems="true">
<asp:ListItem>--Please Select--
<asp:TextBox ID="dest1Text" runat="server" Visible="False">
<br />
</td>
</tr>
<tr>
<td class="style9">
<asp:Label ID="Label3" runat="server" Text="Date:"></td>
musiw
11-Dec-11 22:29pm
View
i already try to follow the code given.but it still doesnt appear as i want. when i click the radiobutton nothing happen.my code is same with the link.
blur.....
musiw
11-Dec-11 21:42pm
View
thanx habib! :D
but i have another question...when i click a radiobuttonlist i want to make panel of form visible.but it doesnt appear.
protected void Button1_Click1(object sender, EventArgs e)
{
if (ddl1.SelectedIndex == 1)
{
RadioButtonList1.Visible = true;
ListItem item;
item = new ListItem("KVDT & RIDT", "1");
RadioButtonList1.Items.Add(item);
item = new ListItem("Outside DT", "2");
RadioButtonList1.Items.Add(item);
}
if (ddl1.SelectedIndex == 2)
{
RadioButtonList1.Visible = true;
ListItem item;
item = new ListItem("ETS/EMU", "1");
RadioButtonList1.Items.Add(item);
item = new ListItem("Locomotive", "2");
RadioButtonList1.Items.Add(item);
}
}
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (RadioButtonList1.SelectedIndex == 1)
{
Label4.Text = "Reactionary Delay";
Panel1.Visible = true;
}
if (RadioButtonList1.SelectedIndex == 2)
{
Label4.Text = "Cause";
Panel1.Visible = true;
}
}
is it possible radiobutton to handle event?can u help me
thanx
musiw
24-Nov-11 21:01pm
View
TQ Jeetu :)
Show More