|
Hi there,
Add an additional TextBox Web control to overcome the Enter problem in IE, but hide the TextBox so your users see only one:
<form id="Form1" runat="server">
<div>
Name: <asp:TextBox runat="server" id="txtName"/>
<br />
<asp:TextBox ID="TextBox1" runat="server" style="visibility:hidden;display:none;" />
<asp:LinkButton ID="LinkButton1" runat="server" <pre>OnClick ="LinkButton1_Click">LinkButton</asp:LinkButton>
</div>
In ur Code Behid:
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
<br />
txtName.Attributes.Add("onKeyPress", "javascript:if (event.keyCode == 13) __doPostBack('" + LinkButton1.UniqueID + "','')");<br />
<br />
}<br />
<br />
protected void LinkButton1_Click(object sender, EventArgs e)<br />
{<br />
txtName.Text = "Hai";<br />
}<br />
<br />
Now it works fine.
-- modified at 3:37 Wednesday 11th October, 2006
Regards,
Jay
|
|
|
|
|
Hi Jay,
I tried to write code as advised u,I even copy pasted the same code but it still isn't working.
What could b the problem?
Thanks,
Mini
|
|
|
|
|
Hi there,
+ I ve just given the idea only. I have just modified my previous post My Post[^]
Now you can copy and use it, it ll work fine. Try it and let me know.
Regards,
Jay
|
|
|
|
|
Thanks Jay now its working fine
Mini
|
|
|
|
|
Thats Good
Regards,
Jay
|
|
|
|
|
i have a datagrid(in c# asp.net) and i want select more than one record
e.g. i want to have a templete coulmn with checkbox and select more than one record for deleting. can any body help me?
do u know other way for multiselect?
-- modified at 3:48 Saturday 7th October, 2006
|
|
|
|
|
i want to copy the 10 rows of a datatable to another datatable
but it occur a error "This row already belongs to another table."
how can i solve it ?
MHF
|
|
|
|
|
Traverse your 10 rows and while traversing create array of objects to store information of each field and insert this object to destination table.
eg. Source Table is dsTempSearchMemo and Destination is dtSearchSeizureTemp
//For Loop
object[] objVal = {
dsTempSearchMemo.Rows[j][0],
dsTempSearchMemo.Rows[j][1],
dsTempSearchMemo.Rows[j][2],
dsTempSearchMemo.Rows[j][3],
dsTempSearchMemo.Rows[j][4],
dsTempSearchMemo.Rows[j][5],
dsTempSearchMemo.Rows[j][6],
dsTempSearchMemo.Rows[j][7],
dsTempSearchMemo.Rows[j][8],
dsTempSearchMemo.Rows[j][9],
dsTempSearchMemo.Rows[j][10],
dsTempSearchMemo.Rows[j][11],
dsTempSearchMemo.Rows[j][12],
dsTempSearchMemo.Rows[j][13],
dsTempSearchMemo.Rows[j][14],
dsTempSearchMemo.Rows[j][15]
};
dtSearchSeizureTemp.Rows.Add(objVal);
|
|
|
|
|
What you have tried is to copy the reference of the rows. What you have to do is to copy the actual rows, i.e. create new rows with the same data.
---
b { font-weight: normal; }
|
|
|
|
|
Is there any Standard to write code comments for c# ASP.NET projects?
|
|
|
|
|
abhisheks23 wrote: Is there any Standard to write code comments for c# ASP.NET projects?
Everyone has an opinion - so I'd say there are many standards for commenting code. If you want to get some ideas of codified standards (pun not intended), try google for "c# commenting standard".
|
|
|
|
|
i write asp not asp.net
don't error but data not insert into database
i don't sure i write wrong
//code//
//when input new data--> series,model,sfx check in database if have field series ,model, sfx already insert z ,y, x…..last field-->sfx//
If (Request("savetypenew") ="บันทึก" ) then
If (Request("nmtypenew1") <> "") and (Request("nmtypenew2") <> "") and (Request("nmtypenew3") <> "") then
If (len(Request("nmtypenew1")) >= 12) and (len(Request("nmtypenew2")) >= 2) and (len(Request("nmtypenew3")) >= 1) then
// create array //
Cha = array
("Z","Y","X","W","V","U","T","S","R","Q","P","O","N","M","L","K","J","I","H","G","F","E","D","C","B","A")
//check if have--> series ,model, sfx//
sql = ""
sql = sql &"select count(MMT_MOD_SFX) as AMOUNT_SFX,count(MMT_SRS_CD) as AMOUNT_SRS,count(MMT_MOD_CD) as AMOUNT_MOD"
sql = sql &" from DSP_MOD_MST"
sql = sql &" where MMT_MOD_SFX = '"&Request("nmtypenew2")&"'"
sql = sql &" and MMT_SRS_CD= '"&Request("codetypenew1")&"'"
sql = sql &" and MMT_MOD_CD = '"&Request("nmtypenew1")&"'"
set rs = conn.execute(sql)
if not rs.eof then
Totalrecord = rs("AMOUNT_SFX")
for i = 0 to Cint(Totalrecord)-1
sql = ""
sql = "Select * From DSP_MOD_MST"
sql = sql & " Where MMT_SRS_CD = '" &Request("codetypenew1")& "' and"
sql = sql & " MMT_MOD_CD = '" &Request("nmtypenew1")& "' and"
sql = sql & " MMT_MOD_SFX = '" &Request("nmtypenew2")& "' and"
sql = sql & " MMT_FR_DT <= '"&DateNow&"' "
set rs = conn.execute(sql)
do while not rs.eof
rs.movenext
loop
//if data have already then insert and add z in field MMT_MOD_SFX value Request("nmtypenew2")&Cha(i)//
sql = ""
sql = "Insert Into DSP_MOD_MST"
…….
…….
sql = sql & " MMT_MOD_SFX,"
sql = sql & " Values ('"&Request("codetypenew1")&"' , "
…….
…….
sql = sql & " '"&Request("nmtypenew2")&Cha(i)&"' , "
end if
next
else
if data haven't already then normal insert not add z
Preaw
|
|
|
|
|
hi there,
i want to make a datagrid whose first column will be stable and rest columns can scroll horizontally.plz help me.
varuni
|
|
|
|
|
|
thanx jay but i did not got any grid there which fulfils my requirement if you find it plz tell me .
regards,
deepti
|
|
|
|
|
|
hey jay,
it is exactly the same thing what i need . thanx alot
Deepti
|
|
|
|
|
I am not using Crystal Report in my report generation.
I just design the report on the web form and those datagrid will show on the web form.
Unfortunately, when the datagrid exceed more that a page, than i need to let it automatically show continue on the another web form with the same report format.
Will it be done just on the web form without using Crystal Report?
Any advice and suggestion? Thank You.;)
|
|
|
|
|
Hello,
I added, at runtime, a button field of type link to a gridview.
Now I need url of that button, when pressed, to be as follows:
"news.aspx?id=" & channel
"Channel" is the first column of my datasource which is linked to the gridview.
How can I do this?
Here is the code of my button:
Dim bIcon As New ButtonField
With bIcon
.ButtonType = ButtonType.Link
.ImageUrl = Me.GetLocalResourceObject("bIcon.ImageUrl").ToString()
End With
gvRSSChannels.Columns.Add(bIcon)
Thanks,
Miguel
|
|
|
|
|
Hello,
I created an Hyperlink field in a GridView but I can't find and
ImageUrl property.
I know normal Asp:Hyperlink control can also be used with an Image. Is
this possible in GridView?
Then I tried to use a button field but I can't see a way to build the
NavigateUrl as I need and as you can see in my Hyperlink button:
' Create, define and add url hyperlink field
Dim hfUrl As New HyperLinkField
With hfUrl
.DataNavigateUrlFields = New String() {"Channel"}
.DataNavigateUrlFormatString = "RSS.ashx?Channel={0}&" &
"Culture=" &
System.Threading.Thread.CurrentThread.CurrentCulture.ToString()
End With
gvRSSChannels.Columns.Add(hfUrl)
Could someone please help me out?
Thanks,
Miguel
|
|
|
|
|
In a small form there is an asp:Panel;
A botton dinamically adds a CheckBox to the panel;
The user checks the checkBox;
A second botton asks for the number o controls inside the panel (what cause a round trip to the server);
The answer is "none" meaning the CheckBox created previously did not persist:
Please, how to know if the user has ore has not checked the checkBox ?
Thank you very much in advance.
-------------------------------------------------------
PS: I have tried to add enableViewState=true to both checkBox and Panel - does not work
PS2: In case it helps, here os the code...
<%@ Page Language="vb" Debug="true" trace="true" %>
Sub cmdFills_Click (ByVal sender As Object, ByVal e As System.EventArgs)
Dim ckbBox1 As CheckBox = new CheckBox
ckbBox1.text = "Box 01"
ckbBox1.enableViewState = True
pnlTest.Controls.Add(ckbBox1)
pnlTest.enableViewState = True
Dim ckbBox2 As CheckBox = new CheckBox
pnlTest.Controls.Add(ckbBox2)
txtCount.text = pnlTest.Controls.count.toString() & " checkBoxes"
end sub
Sub cmdCount_Click (ByVal sender As Object, ByVal e As System.EventArgs)
txtCount.text = pnlTest.Controls.count.toString() & " checkBoxes"
end sub
Sub cmdChecked_Click (ByVal sender As Object, ByVal e As System.EventArgs)
txtChecked.text = "Checked?"
end sub
Sub ckbChanged (ByVal sender As Object, ByVal e As System.EventArgs)
txtChecked.text = "ckbChanged "
end sub
<title>New Page 1
Test PANEL
<asp:panel id="pnlTest" runat="server" backcolor="#FFFFCC">
<asp:button runat="server" text="Creates CheckBox" id="cmdFills" onclick="cmdFills_Click">
<asp:button runat="server" text="Count" id="cmdCount" onclick="cmdCount_Click">
<asp:textbox id="txtCount" runat="server">
<asp:button runat="server" text="Is Checked ?" id="cmdChecked" onclick="cmdChecked_Click">
<asp:textbox id="txtChecked" runat="server">
Ricardo COnte
|
|
|
|
|
Hi Ricardo. The issue is that the checkbox in question doesn't exist until you add it in code - and that will be long past the point where control properties and viewstate are addressed in the page cycle.
Here's an alternative you may like better. In your panel, declare your checkbox so it exists, but set its Visible property to false. When the appropriate condition occurs, set the checkbox Visible to true.
This way, the checkbox will always exist, its Checked value always persisted through ViewState, but it will only be visible to the user when you want it to be.
|
|
|
|
|
Thank you very much, Ellison, yours is a good idea, I will use it.
This time although I will not fit, my fault.
In fact I have a variable number of check boxes, one for each of a group of records, wich are, say 130+.
I was making a "check-list": some records are read, I create a box for each of them and hoped to find out wich ones the user had checked. When loaded first time the check boxes show the previous choice from the user.
The boxes are created in a post-back, in the "PostBackEvent". The check-boxes are beeing verified also in the post-back event, but in the NEXT post-back.
I thought the check boxes would persist between postbacks but it does not seam to be the case.
Do you know how to make the check boxes persist ?.
Thaks again, Ricardo
Ricardo Conte
|
|
|
|
|
Okay - you can still use the same idea here, even if you have to dynamically create your boxes. In your Page_Load code, you have to create all the checkboxes you may end up using in code, whether or not it is a postback. Again, with the checkboxes that should be unavailable with the visible attribute set to false.
Read through this article on the page/control lifecycle for some perspective on what is going on:
http://msdn2.microsoft.com/en-us/library/ms178472.aspx[^]
|
|
|
|
|
Solved ! Thank you very much for your help.
Let me tell you:
First I was doing:
1. created "n" check boxes inside a panel
2. user would "check" some
3. user would submit the form
4. I would not re-create the boxes thinking ASP.NET would persist the boxes... mistake ! I does not persist the boxes !
5. I would try to count the "checked" boxes, finding there were none !
The rigth thing to do:
1. firts create the boxes
2. let user "check" some
3. let user submit form
4. just create AGAIN the boxes ! (contrary to common sense) and ASP.NET will recognize that and persist the CONTENTS !
Ok, I gess it is a novice´s mistake...
Best Regards,
Ricardo Conte
|
|
|
|
|