|
SqlData.BusinessAssociateContactChangeRequest baContact = new BusinessAssociateWorkFlow.SqlData.BusinessAssociateContactChangeRequest();
How can baContact be null? It doesn't matter if it inserting into the database or not at this point.
only two letters away from being an asset
|
|
|
|
|
I'm not sure. The error was object reference not set to an instance. I don't what else it could have been.
I didn't get any requirements for the signature
|
|
|
|
|
I was able to get my code to work with the following, but it seems inefficient.
<br />
int baRequestTypeId = int.Parse(this.rblMode.SelectedValue);<br />
int baAssociateTypeId = int.Parse(this.rcbAssociateType.SelectedValue);<br />
int baBusinessTypeId = int.Parse(this.rcbBusinessType.SelectedValue);<br />
<br />
<br />
<br />
SqlData.BusinessAssociateWorkFlowData dataContext = new BusinessAssociateWorkFlow.SqlData.BusinessAssociateWorkFlowData();<br />
SqlData.BusinessAssociateContactChangeRequest baContact = new BusinessAssociateWorkFlow.SqlData.BusinessAssociateContactChangeRequest();<br />
<br />
SqlData.RequestType baRequestType = (from r in dataContext.RequestType<br />
where r.RequestTypeId == baRequestTypeId<br />
select r).First();<br />
<br />
SqlData.BusinessAssociateType baBusinessAssociateType = (from b in dataContext.BusinessAssociateType <br />
where b.BusinessAssociateTypeId == baAssociateTypeId<br />
select b).First();<br />
<br />
<br />
SqlData.BusinessType baBusinessType = (from b in dataContext.BusinessType<br />
where b.BusinessTypeId == baBusinessTypeId<br />
select b).First();<br />
baContact.RequestType = baRequestType;<br />
baContact.BusinessAssociateType = baBusinessAssociateType;<br />
baContact.BusinessType = baBusinessType;<br />
baContact.Name = this.rtbName.Text;<br />
baContact.Abbreviation = this.rtbAbbreviation.Text;<br />
baContact.Code = this.rtbCode.Text;<br />
baContact.CreatedBy = User.Identity.Name;<br />
baContact.CreatedOn = DateTime.Now;<br />
baContact.LastModifiedBy = User.Identity.Name;<br />
baContact.LastModifiedOn = DateTime.Now;<br />
baContact.ContactAddress.Add(this.AddressCntrl1.GetContactAddressEntity(ref dataContext));<br />
dataContext.SaveChanges();<br />
<br />
I didn't get any requirements for the signature
|
|
|
|
|
Todd,
I didn't see your original question as it has been deleted.
However, if I got this right you don't need to requery baRequestType, baBusinessAssociateType and baBusinessType.
Your baContact should contain the property xxxxReference (where xxxx stands for the foreign key class), e.g. requestTypeReference.
Instead of requerying all the types you can simply create an entity key and assign it to the xxxxReference.EntityKey property.
Example:
baContact.RequestTypeReference.EntityKey = new EntityKey("YourDataSetNamespace.YourDataSetName", "YourPKPropertyName", yourValue);
Cheers,
Ed
|
|
|
|
|
Your answer does seem to be the correct solution. Thank you.
I don't know if I like it though. I don't understand why a table column value can't be set as a property just because there is a foreign key on it.
I didn't get any requirements for the signature
|
|
|
|
|
Hi,
I have 2 dropdownlists on a page. (DDL1 and DDL2). The DDL1 is populated by values from the database using a SqlDataSource(SDC1). DDL2 is dependent on DDL1. As soon as a value is selected in DDL1 I need to populate values in DDL2, though using SqlDataSource SDC2 which is also available on the page.
SDC2 is defined with correct select sqls and where clause parameters during design time but I need to know how I can populate DDL2 only after a value is selected in DDL1. This might sound as a redundant question though I never found a post that will help me achieve this using SDC.
Thanks for your help in advance.
|
|
|
|
|
|
Hello Friends,
I've a GridView inside a UpdatePanel. And there is a Fileupload control inside the GridView which is fired to Update the existing image with newer one. My code is running perfectly without UpdatePanel. But as i put my GridView inside the UpdatePanel it gives me an error "Object References not set to an instance". I think this error is being generated because of FileUpload control. So i want to have a trigger control of UpdatePanel to upload the new image. How can i bind a trigger control of UpdatePanel at RowUpdating event of GridView at code behind
|
|
|
|
|
If you have to refresh the grid when file upload occurs why do you place the GridView inside the update panel???
You can use PostBack trigger to upload files..
Check this[^] how they are doing fileupload from within the updatepanel using PostBack Trigger.
|
|
|
|
|
I dont have to refresh the page. I just want to use PostBack trigger. But PostBack trigger needs a ControlID so what will be the ControlID for PostBack Trigger. Because i'm using RowUpdating event of GridView......
|
|
|
|
|
AFAIK... Postback trigger will used to postback the whole page to the server...
The controlId of the PostBack trigger should be the control that should invoke the Postback from within the UpdatePanel.
If you want Button1 which is placed within the UpdatePanel to postback the page, rather than going for partial update, just use ControlID = "Button1" For your help, lets give you a sample code :
<asp:UpdatePanel ID="upTest" ChildrenAsTriggers="False" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<asp:Label ID="lblResults" runat="server"></asp:Label><br /><br />
<asp:Button ID="btnAsync" Text="Asynch Post" runat="server" OnClick="btnAsync_Click" />
<asp:Button ID="btnFullPost" Text="Full Post" runat="server" OnClick="btnFullPost_Click" >
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnAsync" EventName="Click" />
<asp:PostBackTrigger ControlID="btnFullPost" />
</Triggers>
</asp:UpdatePanel>
AsyncPostBackTrigger will postback asynchronously while PostBackTrigger will do this normally...
|
|
|
|
|
I have the same problem can you take a look:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ctrlUserProfilePics.ascx.cs"
Inherits="OmegaLove.Web.UI.ctrlUserProfilePics" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%--<%@ Register Src="ctrlGPStatusBox.ascx" TagName="ctrlGPStatusBox" TagPrefix="uc1" %>
--%>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<br />
<div id="UploadArea">
<table>
<tr>
<td>
Browse Image:
</td>
<td>
<asp:FileUpload ID="FileUpload1" runat="server" />
</td>
</tr>
</table>
</div>
<p>
<asp:Button ID="UploadButton" runat="server" Text="Upload Now" OnClick="UploadButton_Click" />
</p>
<asp:Label ID="lblResult" runat="server" ForeColor="#0066FF"></asp:Label>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="UploadButton" />
</Triggers>
</asp:UpdatePanel>
<br />
<hr />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="5"
GridLines="None" ShowHeader="False">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Image ID="imgSaved" runat="server" ImageUrl='<%# imageURL(DataBinder.Eval(Container.DataItem, "img_id").ToString()) %>'
AlternateText='<%#DataBinder.Eval(Container.DataItem,"img_title") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EmptyDataTemplate>
No records found
</EmptyDataTemplate>
</asp:GridView>
|
|
|
|
|
Hi,
My Ms-Access Database is on my website.
ftp//ftp.WebsiteName.com/App_Data/SerialNo.mdb
What will be my connection sting.
Thanks
|
|
|
|
|
|
You want to have connection to your database using ftp protocol.... ?????
Please download the file to your own location and use it.. Or you can use unc path to the server like \\yourserverip\app_Data\serialNo.mdb
In ftp, you need to create session to pass ftp commands like open, mput, mget etc... Your session will be terminated just like the HTTP session timeouts, if left idle. So I dont think you can work with this directly using this way...
Just point the file through network path.
|
|
|
|
|
I have a page which has 4 user controls on it.
The problem is : I have a link on this user control and when clicked goes to other page but I dunno how to pass the session variable to the other page from this page containing that uc.
The other page always gets the same values as the session variable doesn't update when user control is clicked for different values.
|
|
|
|
|
Session["SomeKey"] = SomeValue
This doesn't work for you? Perhaps you should show a little of what you are doing.
only two letters away from being an asset
|
|
|
|
|
the session values pass across all pages .
The problem is on this page I have a user control which is a grid with links. when i click on these links i am passed to other pages with different values for different links of the grid.
but the next page gets only those values which are set in the first page where UC is embedded I need to change values in UC.
|
|
|
|
|
I still don't get what the difficulty is. You can't handle the click event in the user control and make the appropriate settings?
only two letters away from being an asset
|
|
|
|
|
he he he!!
sorry mayb i was not clear in my question.
The thing is i was handling the UC [which had a grid with links]events and not UC Clicked event and that has limitations but i got a workaround. Many thanks.
|
|
|
|
|
If you want to set Session variable while clicking link you can do by Session["Key"]=value in the click event.
Can u plz clarify your question so that we can help you?
|
|
|
|
|
Wow, wish I had thought of that
only two letters away from being an asset
|
|
|
|
|
Hi ,
I store the image in a binary format into THE DATA BASE and while retriving i select byte array from data base noe i am using http handler to display image by giving
image1.imageurl = "ImageHttpHandler.ashx"
how to draw image here again .
Thanks and regards,
Amit Patel
|
|
|
|
|
Amit Patel1985 wrote: image1.imageurl = "ImageHttpHandler.ashx"
What you need, is to point the imageurl to a page which takes an id on the URL, and reads the image associated with that id and returns it instead of a page. Pointing to an ashx isn't going to do anything.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
how can i use edit update function in detailsview as i use in grid view.plz help me out ......thanks in Advance...........
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.IO;
public partial class Update_Finance_Details_After_Bill : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindData();
}
}
private void BindData()
{
SqlConnection con = new SqlConnection("Data Source=software;Initial Catalog=LHPL_INFO;Integrated Security=True");
SqlDataAdapter da = new SqlDataAdapter("SELECT SL_NO,GRC_No, Name_of_person, Name_Or_Number_Of_Rooms_Occupied , Date, Time, Check_In_No,Sale_Voucher_No,Party_Debit_Voucher_No FROM LHPL", con);
DataTable dt = new DataTable();
da.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
}
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
BindData();
}
protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
GridView1.EditIndex = -1;
BindData();
}
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
if (((LinkButton)GridView1.Rows[0].Cells[0].Controls[0]).Text == "Insert")
{
SqlConnection con = new SqlConnection("Data Source=software;Initial Catalog=LHPL_INFO;Integrated Security=True");
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "INSERT INTO LHPL(Party_Debit_Voucher_No) VALUES(@Party_Debit_Voucher_No)";
cmd.Parameters.Add("@Party_Debit_Voucher_No", SqlDbType.VarChar).Value = ((TextBox)GridView1.Rows[0].Cells[2].Controls[0]).Text;
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
else
{
SqlConnection con = new SqlConnection("Data Source=software;Initial Catalog=LHPL_INFO;Integrated Security=True");
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "UPDATE LHPL SET Party_Debit_Voucher_No=@Party_Debit_Voucher_No WHERE SL_NO=@SL_NO";
cmd.Parameters.Add("@Party_Debit_Voucher_No", SqlDbType.VarChar).Value = ((TextBox)GridView1.Rows[e.RowIndex].Cells[2].Controls[0]).Text;
cmd.Parameters.Add("@SL_NO", SqlDbType.Int).Value = Convert.ToInt32(GridView1.Rows[e.RowIndex].Cells[1].Text);
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
GridView1.EditIndex = -1;
BindData();
}
protected void btnAdd_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=software;Initial Catalog=LHPL_INFO;Integrated Security=True");
SqlDataAdapter da = new SqlDataAdapter("SELECT SL_NO,Sale_Voucher_No,GRC_No ,Party_Debit_Voucher_NoFROM LHPL", con);
DataTable dt = new DataTable();
da.Fill(dt);
// Here we'll add a blank row to the returned DataTable
DataRow dr = dt.NewRow();
dt.Rows.InsertAt(dr, 0);
//Creating the first row of GridView to be Editable
GridView1.EditIndex = 0;
GridView1.DataSource = dt;
GridView1.DataBind();
//Changing the Text for Inserting a New Record
((LinkButton)GridView1.Rows[0].Cells[0].Controls[0]).Text = "Insert";
}
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=software;Initial Catalog=LHPL_INFO;Integrated Security=True");
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "DELETE FROM LHPL WHERE SL_NO=@SL_NO";
cmd.Parameters.Add("@SL_NO", SqlDbType.Int).Value = Convert.ToInt32(GridView1.Rows[e.RowIndex].Cells[1].Text);
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
BindData();
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
}
protected void TextBox2_TextChanged(object sender, EventArgs e)
{
}
protected void Button3_Click(object sender, EventArgs e)
{
}
protected void Button4_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=software;Initial Catalog=LHPL_INFO;Integrated Security=True");
SqlDataAdapter da = new SqlDataAdapter("SELECT SL_NO,GRC_No, Name_of_person, Name_Or_Number_Of_Rooms_Occupied , Date, Time, Check_In_No ,Sale_Voucher_No ,Party_Debit_Voucher_No FROM LHPL where GRC_No ='" + TextBox1.Text + "'", con);
DataTable dt = new DataTable();
da.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void Button2_Click1(object sender, EventArgs e)
{
}
}
|
|
|
|