|
Stop asking the same question. Remove the other two before someone responds.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi guys,
I have 3 submit buttons on a single page. Each submit button is linked to its controls via a "ValidationGroup". One of the groups even has a Custom Validator. The problem I am having is that the validation is not even firing. I have no idea why. I hope the answer is not silly
Here is the HTML for ONE of the groups:
<div id="dvRegistrationValidation" runat="server">
<asp:RequiredFieldValidator ID="rfvRegistrationCode" ControlToValidate="txtRegistrationCode"
Display="None" ValidationGroup="RegistrationProcess" ErrorMessage="Registration Code"
runat="server"></asp:RequiredFieldValidator>
<asp:CustomValidator ID="cstTarget" runat="server" ErrorMessage="Either Head Office or Farm Site/Unit"
ValidationGroup="RegistrationProcess" OnServerValidate="cstTarget_ServerValidate"
Display="None"></asp:CustomValidator>
<asp:ValidationSummary ID="vsRegistration" runat="server" DisplayMode="BulletList"
ShowSummary="true" HeaderText="The following fields are mandatory:" ValidationGroup="RegistrationProcess" />
</div>
And here is the OnServerValidate Sub Routine:
Sub cstTarget_ServerValidate(ByVal source As Object, ByVal e As ServerValidateEventArgs) Handles cstTarget.ServerValidate
If Me.chkTarget1.Checked = True And Me.chkTarget2.Checked = True Then
e.IsValid = False
ElseIf Me.chkTarget1.Checked = False And Me.chkTarget2.Checked = False Then
e.IsValid = False
ElseIf Me.chkTarget1.Checked = True And Me.chkTarget2.Checked = False Then
e.IsValid = True
ElseIf Me.chkTarget1.Checked = False And Me.chkTarget2.Checked = True Then
e.IsValid = True
End If
End Sub
I appreciate any help given. Thanks!
|
|
|
|
|
Oh dear!
I solved it. just for others to know my silly mistake...
I need to make the "ValidationGroup" for each button of the each group the same as what was applied in the controls of that group.
e.g.
<asp:Textbox id="txt1" runat="server" ValidationGroup="Validation1"></asp:TextBox>
<asp:RequiredFieldValidator id="rfv1" runat="server" ValidationGroup="Validation1"></asp:RequiredFieldValidator>
<asp:Button id="btn1" runat="server" ValidationGroup="Validation1"></asp:Button>
<asp:ValidationSummary id="vs1" runat="server" ValidationGroup="Validation1"></asp:ValidationSummary>
|
|
|
|
|
... and you could reduce the validate method to a simple
e.IsValid = Me.chkTarget1.Checked <> Me.chkTarget2.Checked
|
|
|
|
|
Thanks for that
|
|
|
|
|
you're welcome.
|
|
|
|
|
hi, iam using asp.net with c#;
iam having 5 textboxes
textbox1==username
textbox2=how many images on top of the page
textbox3=how many images on bottom of the page
textbox4=how many images on left of the page
textbox5=how many images on right of the page
and a button to create
when user click on button then new page is created with username and image controls are displayed on top,bottom,right ,left and with there events
then user can upload the images with browse upload control .
how to do this can you give me example which helps me
|
|
|
|
|
you can create a user control contain 5 textboxes and a button
and write a function to deal with under the event of Button_click
|
|
|
|
|
hi iam using asp.net with c#
i have two images imgnew and imagold when i click on browse button i will upload the image and put in imgnew image and the previous image will be in imgold image control it is going fine but when iam closing the application .then again old images are there swap images are not present
can you correct my code where iam going wrong .which helps me
protected void Button1_Click(object sender, EventArgs e)
{ImgOld.Src=ImgNew.Src;
if (FileUpload1.HasFile)
{
FileUpload1.SaveAs(MapPath("~/images/" + FileUpload1.FileName));
ImgNew.Src= "~/images/" + FileUpload1.FileName;
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="transfer.aspx.cs" Inherits="transfer" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<img id="ImgNew" alt="ImgNew" src="PH02071U.BMP" style="z-index: 102; left: 144px;
width: 144px; position: absolute; top: 104px; height: 200px" runat="server" />
<img id="ImgOld" alt="ImgOld" src="" style="z-index: 103; left: 376px; width: 144px;
position: absolute; top: 112px; height: 184px" runat="server" />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Style="z-index: 100;
left: 280px; position: absolute; top: 424px" Text="Save" />
<asp:FileUpload ID="FileUpload1" runat="server" Style="z-index: 104; left: 152px;
position: absolute; top: 328px" Width="160px" />
</div>
</form>
</body>
</html
i want what ever i have changed that shoul be present after closing appplication also
|
|
|
|
|
hello
i am new to asp.net i have created on small web project with one datagrid on page and when i drag and drop sql data adapter on page it shows error "Generated SELECT Statment"
and then i have managed to solve this issue but now it showing
"Generated CANCEL Statment"
"Generated UPDATE Statment"
"Generated DELETE Statment"
so i dont know what to do now so I have tried to run the project but it also showing error
Server Error in '/WebApplication3' Application.
--------------------------------------------------------------------------------
Login failed for user 'MACHINE NAME\ASPNET'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Login failed for use MACHINE NAME\ASPNET'.
Source Error:
Line 59: 'Put user code to initialize the page here
Line 60: If Not Page.IsPostBack Then
Line 61: SqlDataAdapter1.Fill(DataSet11)
Line 62: DataBind()
Line 63:
Source File: c:\inetpub\wwwroot\WebApplication3\WebForm1.aspx.vb Line: 61
Stack Trace:
[SqlException: Login failed for user 'DEEPAK-5WT558AI\ASPNET'.]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +474
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +372
System.Data.SqlClient.SqlConnection.Open() +384
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) +44
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +38
WebApplication3.WebForm1.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\WebApplication3\WebForm1.aspx.vb:61
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2443; ASP.NET Version:1.1.4322.2443
I AM USING VISUAL STUDIO 2003 WITH SQL SERVER 2008 PRO.
SO NOW I HAVE NO IDEA WHAT TO DO
WAITING FOR YOUR KIND HELP
THANKS
|
|
|
|
|
If your database is using integrated authentication (looks like it from your trace), have you defined the ASPNET user in the database?
|
|
|
|
|
Hello sir
thanks for your rep.
but i dont know how to do it i am still searching on net
waiting for your kind rep.
thanks
|
|
|
|
|
Is this your database? Have you installed it? If not you should the ask the system administrator or whoever created this database to add you (or your aspnet user to the database.
Have you ever connected succesfully to this database? Can you for example use SQL Administrator to browse data?
|
|
|
|
|
hello sir
thanks for your prompt response
currently i have one small assignment to create web project with one page so it should display author table from pubs database into datagrid thats all
so what i have done drag and drop sql data adapter on the web page and went through wizard to complite but at the end of wizard it shows generated error for update, delete and cancle so i dont know what to do with this and when i try to run the project it shows loging error
but if i right click on sql data adapter and select priview data it shows all the data
waiting for your kind help
have a nice time
|
|
|
|
|
Im using windows authentication in asp.net application and it is working fine...
I need to give roles for particular user group..
how do we get the user groups from active directory....
Searched google but i could not find that..
Help me out....
|
|
|
|
|
|
|
In my scenario, I need to group the products based on category. The "main" header has columns Product name, Description, Unit and Unitprice. I am programatically adding "secondary" / "sub" header for each cateogry and list the respective product underneath.
I overrode the render function like this
GridViewRow NewHeader = new GridViewRow(rowIndex + 1, rowIndex + 1, DataControlRowType.Header, DataControlRowState.Normal);
GridView1.Controls[0].Rows.AddAt(rowIndex + 1, NewHeader);
The gridview is created as wished - First appears the main header. And Comes the first sub header followed by the related product rows and then comes the next subheader followed by the corresponding product rows at it goes on.
I want to know how can I access these dynamically created "sub header"s. Gridview1.rows collection has only the data rows and the Gridview1.headerrow has only the default headerr row. Is there a way to access my "sub"header rows?
Thanks
Kit
|
|
|
|
|
sallam 2 all
this is a search query bt i got an exception at column S_No
i.e
Select ROW_NUMBER() OVER(ORDER BY pcpd.Cpt_Code, pcpd.Cpt_Description ASC) AS 'S_No', Provider_Cpt_Plan_Detail_Id, Provider_Cpt_Plan_Id, pcpd.Cpt_Code, isnull(pc.Proc_Description,'') as cpt_description, pcpd.Cpt_Modifier, Non_Facility_Participating_Fee, Non_Facility_Non_Participating_Fee, Facility_Participating_Fee, Facility_Non_Participating_Fee, pcpd.Deleted, pcpd.Created_By, pcpd.Created_Date, pcpd.Modified_By, pcpd.Modified_Date From Provider_Cpt_Plan_Details pcpd left outer join procedures pc on pcpd.Cpt_Code=pc.proc_code Where ORDER BY( pcpd.Cpt_Code, pcpd.Cpt_Description ASC) LIKE '4%' And pcpd.Cpt_Code LIKE '00%' And pcpd.Provider_Cpt_Plan_Id ='100ALLALLALLALLALL' And pcpd.Deleted ='0'
the prob is that i use
Select ROW_NUMBER() OVER(ORDER BY pcpd.Cpt_Code, pcpd.Cpt_Description ASC) AS 'S_No' in select statement im confused what i give in search where clause if i give S_No it gives me error if i give the whole ROW_NUMBER...etc etc it says it is used only in select statement
now it gives me exception Incorrect syntax near the keyword 'ORDER'.
when i used ORDER BY( pcpd.Cpt_Code, pcpd.Cpt_Description ASC) LIKE '4%'
any suggestions what i should do?
|
|
|
|
|
Its better if you post your question in databse section.
|
|
|
|
|
hi iam using asp.net with c#
iam saving two images in database but while retreving only one image is displaying
saving code
==========
protected void Button1_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile && FileUpload2.HasFile)
{
img1.ImageUrl = imgc.ImageUrl;
img2.ImageUrl = imgo.ImageUrl;
FileUpload1.SaveAs(MapPath("~/images/" + FileUpload1.FileName));
imgc.ImageUrl = "~/images/" + FileUpload1.FileName;
FileUpload2.SaveAs(MapPath("~/images/" + FileUpload2.FileName));
imgo.ImageUrl = "~/images/" + FileUpload2.FileName;
con.Open();
SqlCommand cmd = new SqlCommand("Addimgproc", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Shop", "Alsafa");
FileInfo imageinfo = new FileInfo(FileUpload1.PostedFile.FileName.Trim());
byte[] content = new byte[imageinfo.Length];
FileStream imagestream = imageinfo.OpenRead();
imagestream.Read(content, 0, content.Length);
imagestream.Close();
FileInfo imageinfo1 = new FileInfo(FileUpload2.PostedFile.FileName.Trim());
byte[] content1 = new byte[imageinfo1.Length];
FileStream imagestream1 = imageinfo1.OpenRead();
imagestream1.Read(content1, 0, content1.Length);
imagestream1.Close();
cmd.Parameters.AddWithValue("@imgc", content);
cmd.Parameters.AddWithValue("@imgo", content1);
cmd.ExecuteNonQuery();
con.Close();
}
}
retreving code
================
protected void Page_Load(object sender, EventArgs e)
{
SqlCommand cmd = new SqlCommand("select imgc,imgo from images where Shop='Alsafa'", con);
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
if (dr.HasRows)
{
while (dr.Read())
{
Response.ContentType = "image/gif";
Response.BinaryWrite((byte[])dr["imgc"]);
Response.BinaryWrite((byte[])dr["imgo"]);
}
}
i want to display both the images from data base side by side but it is displaying only one image
|
|
|
|
|
See Images are calls from img tag to the server. So for each img tag it will receive one Request. You might write the Image bytes directly on the Response stream using Response.BinaryWrite.
So I think you either need to write the images to some location accessible from outside and set the url to the img tags Or you create one HttpHandler for images, and access the individual images from the client and write each image individually to the response.
Abhishek Sur
Don't forget to click "Good Answer" if you like this Solution. Visit My Website-->www.abhisheksur.com
|
|
|
|
|
Please put a break point inside While statement and check what goes wrong. What is the record count ?
Cheers !
Abhijit Jana | MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Hi all..
I have grid view row commad propery
I can get current index using the follwing
object o = e.CommandArgument;
Int32 rowindex = Convert.ToInt32(o);
but i want to read data from cell
int orgId =Convert.ToInt32(gridClientBasePlan.Rows[rowindex].Cells[0].Text);
This is giving exception how to solve this
|
|
|
|
|