|
Hi,
I have a Imagebutton In a ContentplaceHolder Where I have to Adjust the height and width of the imagebutton with the scrren resolution. for that i had written a javascript..
========================================================
if ((screen.width>1024) && (screen.height>768))
{
var theImg = document.getElementById('Image1');
theImg.width = "100px";
theImg.height = "100px";
}
else
{
var Img = document.getElementById('ctl00_ContentPlaceHolder1_Image1');
Img.width = "50px";
Img.height = "50px";
}
===============================================
in the above code 'Image1' is the id of imagebutton.. im getting null value error when im using the above javascript.
i have also used 'ct100_contentplaceholder_Image1' and '<%image1.ClientID%>' But both of are not worked.
So Please suggest a solution for this problem.
thanks in advance,
vishnu
|
|
|
|
|
Definitely use the ClientID property, because the generated ID could change down the track.
Also, try:
if ((screen.width>1024) && (screen.height>768))
{
var theImg = document.getElementById('<%image1.ClientID%>');
theImg.style.width = "100px";
theImg.style.height = "100px";
}
else
{
var Img = document.getElementById('<%image1.ClientID%>');
Img.style.width = "50px";
Img.style.height = "50px";
}
I believe the width and height properties are a Unit or something similar - the width and height of the style will allow you to enter the CSS-like values (i.e. "100px").
Let me know how you go
P.S. Also check the source of the web page when you view it to ensure that '<%image1.ClientID%>' is actually being replaced with the ClientID.
|
|
|
|
|
Hi All,
I have 2 table with Primary and foreign key constrains.
where primary key is a identity column.
if I insert any value in primary table..child table foreign key value should be inserted automatically..
Is there any way of using it with out triggers? how to do the same for delete?
What is the traditional method...?
Sorry if this is a very basic question!!!
Ramkumar
("When you build bridges you can keep crossing them. ")
http://ramkumarishere.blogspot.com
|
|
|
|
|
You could create a stored procedure to create both the parent and child record, then standardize on that for creating parent records in your application.
Delete would be handled through a foreign key constraint with "cascade delete" option. This means that when the parent record is deleted, then all of the child records would be deleted.
|
|
|
|
|
Thanks for your time.
Do u have any sample stored Procedure or Article related to Insert(with pk as identity column).
goggled it..but could not find proper solution.
Ramkumar
("When you build bridges you can keep crossing them. ")
http://ramkumarishere.blogspot.com
|
|
|
|
|
Do you mean, like using SCOPE_IDENTITY()?
It stores the last inserted primary key value in the current context
DECLARE @Last_PK_Table1 AS INT
INSERT INTO Table1(field1, field2) VALUES ('Field1', 'Field2')
SET @Last_PK_Table1 = SCOPE_IDENTITY()
INSERT INTO Table2(Table1_PK, OtherField, OtherField2) VALUES (@Last_PK_Table1, 'field1', 'field testing')
thankx
|
|
|
|
|
I am using xtraGrid and trying to assign the ID using Eval but the result is showing as project.aspx?id=<%# ("website_project_id") %>
this is the code.. what's is my mistake?
<dxwgv:GridViewDataHyperLinkColumn Name="colProject" FieldName="website_project_name" Caption="Project" PropertiesHyperLinkEdit-NavigateUrlFormatString='project.aspx?id=<%# Eval("website_project_id") %>' />
|
|
|
|
|
You can't use eval inside a string like that. And beside that, it is a formatstring. The syntax for foramtstrings is to use numeric placeholders in curly brackets. Since you are using a specific vendor's control I would suggest using their knowledgebase and forums, but I you could start by investigating the fieldName and textField properties of the column.
|
|
|
|
|
hello,
I want insert student markes by aonce click using a gridview and this code:
private void Update()
{
string cmd = @"UPDATE EXAMEN set NOTE= CASE
WHEN CODE_MATIERE = '1' and @note1 =99 then '0'
when CODE_MATIERE = '1' and @note1 <>99 then @note1
WHEN CODE_MATIERE = '2' and @note2 ='99' then '0'
when CODE_MATIERE = '2' and @note2 <>99 then @note2 END, PRESENCE=
CASE WHEN CODE_MATIERE = '1' and @note1 =99 then 'TRUE'
when CODE_MATIERE = '2' and @note2 ='99' then 'TRUE' else 'FALSE'
end
WHERE NUM_INSCRIPTION = @num;";
float note1, note2;
string num;
SqlCommand myCommand;
SqlParameter param1, param2, param3;
using (SqlConnection myConnection = new SqlConnection(ConnectionString))
{
myConnection.Open();
foreach (GridViewRow row in GridView1.Rows)
{
note1 = float.Parse(((TextBox)row.FindControl("tmoy1")).Text);
note2 = float.Parse(((TextBox)row.FindControl("tmoy4")).Text);
num = ((Label)row.FindControl("lblUserID1")).Text;
myCommand = new SqlCommand(cmd, myConnection);
param1 = new SqlParameter("num", SqlDbType.VarChar, 4);
param1.Value = num;
myCommand.Parameters.Add(param1);
param2 = new SqlParameter("note1", SqlDbType.Float, 2);
param2.Value = note1;
myCommand.Parameters.Add(param2);
param3 = new SqlParameter("note2", SqlDbType.Float, 2);
param3.Value = note2;
myCommand.Parameters.Add(param3);
myCommand.ExecuteNonQuery();
}
} myConnection.Close();
}
but the code not work I tried the float and decimal and money for the type of note
I tried float.parse, Decimal.Parse, convert.todecimal
the code multiplies the values of the first row by 2 for each click on update button bizarre .
help me please,thanks
Écouter
Lire phonétiquement
|
|
|
|
|
Could you please tell which exact error you are getting, Because I have a doubt on your SQL query CASE statement.
Regards,
Hiren.
"We owe a lot to the Indians, who taught us how to count, without which no worthwhile scientific discovery could have been made." - Einstein
Microsoft Dynamics CRM
|
|
|
|
|
Hi,
I have any error message(unless the marks(note) field is empty) but the code does not update data ;
Thanks .
|
|
|
|
|
Hi
i need to have a shotcut key assigned to a menu contol [asp:menu] like in windows . when user gives input as alt+O then it should open FileOpen in turn it will list sub menus Sub menu1,wub menu2,if user gives input as alt+T then it should open sub menu1. is this possible, kindly suggest if some samples.
|
|
|
|
|
Use javascript onkeypress events to capture button combos and do something with (Google it).
But it also depends how you have designed your menus etc. as to what you can do with them
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Good Day All
I have 20 Textboxes and when there are duplicates in those textboxes , i store them in a List<string> and on fly i build a CheckBoxList and display that as a modal and in that i have a close button to allow the user to correct the duplicate item. My Function is working and it is defined like this
private void ShowAjaxModalDynamic(List<string> lstItems, String Message)
{
CheckBoxList lstchecks = new CheckBoxList();
for (int i = 0; i < lstItems.Count; i++)
{
lstchecks.Items.Add("Unit" + lstItems[i]);
}
AjaxControlToolkit.ModalPopupExtender modalPop = new AjaxControlToolkit.ModalPopupExtender();
modalPop.ID = "popUp";
modalPop.PopupControlID = "ModalPanel";
modalPop.TargetControlID = "btnComplete";
modalPop.DropShadow = true;
modalPop.CancelControlID = "btnCancel";
modalPop.BackgroundCssClass = "modalBackground";
this.Panel1.Controls.Add(modalPop);
this.ModalPanel.Controls.Add(lstchecks);
lblPanelMessage.Text = Message;
modalPop.Show();
}
as you can see i will pass the List and the Message to be displayed. Now this is working Perfect.
My Problem is that when the user clicks the close Button to correct the duplicate in those textbox, and re-click the button that will check for Duplicate , the Modal comes back again even if the duplicate has been removed and the break point to the start part that does the validation does not get fired.
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/
|
|
|
|
|
Could we know what code is executed when you click on your 'CheckForDuplicates' button ?
|
|
|
|
|
Basically this is what is happening
For the First it will go through the break point and i will inspect the values and after it Displays the Duplicates in a modal and that is Fine. i will close the modal with the close button on the modal and change those who were Duplicates to be non-duplicates and click the button again, the debug does not go through the break point.
protected void btnComplete_Click1(object sender, EventArgs e)
{
List<string> OBCSerials = new List<string>();
OBCSerial = CheckDuplicates();
if(OBCSerial.Count > 0)
{
ShowAjaxModalDynamic(OBCSerial , "These are Duplicates Serials");
}
else
{
}
}
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 didn't catch where you put your breakpoint, that is not reached the second time.
It should be placed on the line if(OBCSerial.Count > 0) , allowing to watch for OBCSerial contents, and see what's happening from there.
|
|
|
|
|
Yes the breakpoint is on that line where i check if the count is greater than zero and i have added another break point on the function that invokes the modal just to make sure. The first time it reached the Break point and the second time it never went there, it immediately showed the modal with the Previous duplicates.
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 can't figure out what's happening. Obviously if the breakpoint is effectively placed where you say it is, and you don't reach it, there must be some details of your implementation missing.
Maybe try to dispose your modal dialog when it's closed. It's just a guess, even if I don't how it could prevent your code from following the normal flow if not disposed.
I'm not an ASP.NET specialist, so I'm afraid I'll be running out of advices from now. Good luck
|
|
|
|
|
Maybe that could be related to your Ajax Modal Popup Extender problem...
|
|
|
|
|
Good Morning phil
i have created a Small Project to reproduce the problem. Please download the Project in the Following link
www.vuyiswamaseko.com/ExampleProblem/ExampleProblem.zip[^]
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/
|
|
|
|
|
Hi phil
I did not really resolve the problem. But i had twigged my code to resolve the problem.
What i did is that i have added another button and obviously give it another name and kept the same caption and gave it a click event that has the same code as the other one. I have change the visibility via css to be invisible when the page loads and when the first “complete” button is click , it will be hidden via css and the second button will show , and after the user has removed the duplicate if he clicks the Complete button that is available it will go to my break point and event the test for duplicate again.
Thanks Guys
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 want to catch event when i click back button in WebBroswer.
how can i do?
hi
My english is a little.
anyway, nice to meet you~~
and give me your advice anytime~
|
|
|
|
|
|